A man in a kayak was rescued after he flipped over in the water off Fort Foster in Kittery Thursday, according to the fire chief.

Kittery Fire Chief David O’Brien said a woman walking near Fort Foster saw the man in distress, hanging onto his kayak, and called for help about 12:10 p.m.

Within about 30 minutes, a Coast Guard boat that was in the area on patrol reached the man near Wood Island, according to O’Brien and Coast Guard Petty Officer Fredrick Drake.

The kayaker’s legs were sticking out from under the kayak when rescuers arrived, according to a Coast Guard statement. The statement quoted Petty Officer 1st Class Amanda Christensen, who was on the rescue boat, saying, “He must have been breathing from a pocket of air in the kayak.”

The unidentified 35-year-old man, who was not wearing a life jacket, was conscious when he was rescued, and the Coast Guard took him to a dock where he was taken by ambulance to Portsmouth Hospital, where he was treated for hypothermia and shock.

Based on the air temperature and the clothing he was wearing, the man would have survived less than two hours if he hadn’t been rescued, the Coast Guard said.