Updated

A charging brown bear proved no match for two friends on a bike ride near Eagle River, Alaska, who fought off the ursine attack with a canister of bear spray.

Alaska Dispatch News reports on James Fredrick and Alexander Ippoliti's ordeal, which began as they were pedaling on military property Saturday morning near Clunie Lake, aware there had been two fatal black bear attacks in Alaska within the last week.

"I made sure I had my bear bell on and bear spray with me," Ippoliti says — ammunition that proved crucial when the pair suddenly heard rustling in the woods next to the gravel road they were cruising.

The two weren't especially concerned at first, per the Alaska Star. "It could have been any kind of animal," Ippoliti says. But it was a brown bear that quickly emerged and charged at the pair, leaping onto Fredrick and tearing him off his bike.

More on this...

As Fredrick tried to position his bike as a buffer between himself and the bear, which was clawing and biting him, Ippoliti got his bear spray out and emptied the entire tank onto the animal. The military veteran tells The Washington Post his Air Force training may have helped keep him calm under pressure.

After the bear fled the scene, the friends noticed a bear cub in a nearby tree, suggesting the attack was likely a mother bear trying to protect her offspring.

Fredrick, who nearly had his carotid artery slashed from the lacerations the bear inflicted on his neck, lost part of his bicep muscle and needed stitches on his face, but he's expected to fully recover.

"This dude saved my life yesterday," he wrote of Ippoliti on Facebook, showing a photo of the two in Fredrick's hospital room. As for Ippoliti, he was back on the trails the next day, per ABC News.

Ippoliti and Frederick's ordeal also follows another "incredibly rare" bear attack that occurred in Maryland.

This article originally appeared on Newser as "Quick-Thinking Friend Saves Bicyclist From Bear Mauling."