(CNN) -- A lone hiker, attacked by a grizzly bear in Montana's Glacier National Park, kept hiking the trail until he found help, the National Park Service said.

The 50-year-old man was hiking alone on the trail from Many Glacier to Piegan Pass Friday when he rounded a bend and encountered a female grizzly and another bear, the agency said in a statement.

The grizzly attacked the hiker, biting his left thigh and his forearm before hoisting him by the foot and shaking him, the park service said. The bear then dropped the man and fled.

Initial reports indicated the hiker was making noise and carrying bear spray but was unable to use it before the attack.

Afterwards, the man continued to hike and eventually came upon a ranger leading a hike. The ranger notified dispatch, while the hiker continued to the Many Glacier Ranger Station and was treated for his injuries, the statement said.

He was later transported to the Blackfeet Community Hospital in Browning, Montana, in stable condition. The hospital treated the hiker's wounds and released him.

Hospital officials said the man was "very lucky."

The trail from Piegan Pass to Feather Plum Falls was closed Friday while rangers investigated the incident. The park encouraged hikers to carry bear spray and remain in groups.