For one soldier, losing a leg in a freak accident is far from a tragedy. It's an inspiration.

In fact, Army Spc. Ezra Maes, 21, says it's probably the best thing that ever happened to him.

"I'll probably say that for the rest of my life," he told Fox News this week.

"Every day I wake up and look at it, and I remember how close I was to losing it all. And I'm still here," he said. "I managed to survive, and this is just the scar I walked away with."

Maes was on a weeklong rotation in Slovakia while deployed to Poland last year. The armor crewman served as a loader for the main cannon of an M1A2 Abrams tank.

He and two crew members fell asleep in the tank one night only to wake up with the hulking machine slowly rolling downhill at 5 mph.

They quickly learned the parking brake had failed. The crew went through all the emergency procedures to get the tank to stop, but nothing worked, Maes recalled.

"We held on and hoped one of the trees stopped us," he said. "And it did, for the most part."

The tank picked up speed, rumbling up to 30 mph, but was slowed after hitting several trees, eventually crashing into an embankment.

Thrown across the tank, Maes' right leg became lodged in the gearing under the tank. The driver smashed his head through the driver's hatch and broke his back, and his gunner dislocated her leg and had a "nasty-looking cut on her inner thigh," Maes said

84-YEAR-OLD US ARMY VET CHALLENGES TSA AGENT TO 10 PUSH-UPS BEFORE HONOR FLIGHT

"I was pretty sore but not knocked out," he said.

Maes focused on helping the other injured crew members. After seeing the cut on his gunner's leg, he knew "we had to get it fixed right away."

He started twisting and turning while lodged under the turret gearing, thinking his uniform was stuck.

"I felt a pop and a rip, and thought, cool, I tore a uniform piece off," Maes said.

Then he noticed it wasn't just his uniform that came off. Maes had self-amputated his leg to become dislodged from the gearing.

He did his best to spring into action but was quickly losing blood.

"I almost fainted on my way out" to help the crew, Maes recalled. They used their belts as tourniquets and started shock procedures, splashing cold water on their faces -- "buddy aid," Maes said.

The tank's radios had been knocked out in the crash and their cell phones were dead or broken -- except one.

"That's when we heard mine go off," Maes said.

The gunner crawled to the phone and gave it to Maes, who summoned rescuers.

"Once they found us, it turned into a bunch of big jokes and laughs," he said. "We were so happy to be getting care, and that we weren't dead."

When someone collected his severed leg, Maes managed to quip: "Hey, bring that back, I want it!"

Maes was taken to a hospital in Landstuhl, Germany, then back overseas to San Antonio, Texas. He was later taken to Brooke Army Medical Center at Fort Sam Houston.

The specialist, who grew up in Colorado and New Mexico, has since been immersed in physical and occupational therapy at the Center for the Intrepid, the medical center's outpatient rehabilitation center. He does yoga up to three times a week, kayaks, works with service dogs -- about anything he can do, he does, Maes said.

"It's the most comprehensive care you can imagine," he said.

He's in the process of being fitted for a long-term prosthetic leg. It's a permanent implant, similar to a dental implant, that will allow him to "clip in and go," he said.

Iniitially stationed at Fort Hood, Texas, in December 2016 after enlisting in the Army, Maes said he's been given a second chance.

Maes, whose great-grandfather served in the Army, can now take his time and decide what to do next with his life. A big part of that will be inspiring and motivating people who are in similar situations.

"Your outlook can change everything. It's 100 percent perspective," he said. "I try and help as many people as possible who are in worse situations."

CLICK HERE TO GET THE FOX NEWS APP