871. A Traveler on Shabbos

Shabbos 27:9

If a person is on a journey, whether by sea or on land, and he expects to enter a city on Shabbos, then if he comes within 2,000 cubits of the city before Shabbos arrives, then he may enter the city, traverse its entirety and continue 2,000 cubits beyond the city in every direction. This is so even though he did not enter the city until after Shabbos had arrived.

Shabbos 27:10

If the traveler planned to enter the city but he fell asleep and did not wake up until after Shabbos began, then if he awakes and finds himself within the city's Shabbos boundary, he may enter the city, traverse its entirety and continue beyond it 2,000 cubits in every direction. Since his intention was to travel to the city, he is considered as if he established his Shabbos residency with the people of the city by entering within their boundary.