image copyrightUS Coast Guardimage captionThe distressed man was spotted near a remote mining camp 40 miles (65km) outside Nome, Alaska

A man has been rescued in Alaska after desperately flagging down help having been attacked and harassed by a grizzly bear for a week.

US Coast Guard officials were alerted by an SOS message on a shack roof and spotted a man waving his arms in the air calling for help.

The man told them he had been attacked by a bear that kept returning to the remote encampment where he was staying.

He was found with chest bruising and an injured leg he had taped up.

The helicopter crew had been on their way to fly a team of scientists on a wildlife research mission when they were diverted off-course by weather and spotted the distress message.

According to the New York Times, the man had almost run out of ammunition for his gun and the door of the shack he was staying had been ripped off.

"At some point, a bear had dragged him down to the river," Lieutenant Commander Jared Carbajal told the newspaper. "He had a pistol. He said that the bear kept coming back every night and he hadn't slept in a few days."

The pilots found the man stumbling out the shack waving a white flag.

The man has not been named but officials said he is in his late 50s or early 60s and had been reported overdue home from the trip by friends.

The US Coast Guard flew him to hospital in order to get medical attention, but say his injuries are not life-threatening.

The Alaska Department for Fish and Game describe the state as "bear country" but emphasises that aggressive encounters with the species are rare.

You might also be interested in:media captionFootage shows the moment a teenage girl in California shoved a bear to protect her dogs