The mission: Liberate a small town in Afghanistan overrun by the Taliban.

That night in 2011, Lance Cpl. Matias Ferreira led fellow Marines into Musa Qala. They cleared out a compound, and then came the fateful moment — Ferreira, a machine-gunner, jumped from a rooftop to retrieve some supplies.

He didn’t see the 30-pound bomb concealed in the ground.

His legs were shattered in the blast. Both had to be amputated below the knee.

Ferreira, now a 28-year-old married father who stands on titanium prosthetics, soon fulfills one of his childhood dreams. On Friday, he becomes a Suffolk County police officer.

“I’m just really eager and excited to prove myself to my colleagues in my new job, my new career, that I’m capable of doing the job just as well as somebody with both legs,” Ferreira said in an interview Thursday at the police academy in Brentwood. “I don’t think the prosthetics hinder me in any way.”

Sign up for The Classroom newsletter. Education on Long Island is changing. Find out how. By clicking Sign up, you agree to our privacy policy.

Ferreira is believed to be one of the nation’s first double amputees to serve as a fully active police officer, said Suffolk Assistant Commissioner Justin Meyers, a department spokesman.

Police Commissioner Timothy Sini called Ferreira “the quintessential example of what we’re looking for” in a cop.

“This is someone who served our nation, paid a significant sacrifice, and is now able to overcome adversity in a tremendous way,” Sini said. “He’s done a terrific job as a recruit in the academy, both physically, academically and in his leadership to the other recruits, and he’s going to make a fine officer.”

Ferreira just completed 29 weeks of training. He’ll drive a police car like any other officer and is scheduled to start patrolling the First Precinct in West Babylon next week.

There were no shortcuts for the recruit with artificial feet. He passed all the physical demands for someone in his age category, running a mile and a half within the required 12 minutes, 29 seconds (his personal best is 11 minutes), and doing 38 sit-ups and 29 push-ups.

Ferreira used humor to break the ice about his prosthetics.

“A lot of guys are like, ‘What happens if one of your legs break?’ ” he said. “ ‘I’m sorry to say, but if I break my leg, I go in the trunk, I put on a new one. If you break your leg, you’re out for a couple months, my friend.’ ”

Fellow recruits were supportive, urging him on. In a sign of respect, they made him class president.

Lt. Steven Rohde, who heads the academy’s recruit training section, said he periodically asked Ferreira if he needed any special accommodations.

The answer was always the same: “I don’t need anything, sir.”

Six weeks into training, Rohde said recruits trained with retractable batons, practicing striking a man in a protective suit posing as a noncompliant, aggressive suspect.

In a moment caught on video, the suspect charged Ferreira, causing him to fall, but the recruit quickly regained his footing.

Said Rohde: “We didn’t know if he would fall and not be able to get back up, so for us it was an important moment. . . . Kind of an exclamation point on ‘this guy’s the real deal.’ ”

After his war injuries, including a broken femur and pelvis, Ferreira spent about a year in the hospital and undergoing rehabilitation at a military hospital outside Washington, D.C. Falling into depression wasn’t an option, he said. He drew strength from his faith and strong family support.

Within three months, he was walking. Two months after that, he ran a 5-mile race.

He also played on The Wounded Warrior Amputee Softball Team, which brought him to a Smithtown bar in 2012, where he met his future wife, Tiffany. They have a 2-year-old daughter, Tianna.

At the urging of his wife’s cousin, Jereme Matthews, a veteran Second Precinct officer, Ferreira took the police Civil Service test in June 2015. With credit for his military service, he scored a perfect 100.

Ferreira, who is fluent in Spanish, was born in Uruguay. His family moved to the Atlanta area when he was a child to pursue “the American dream,” he said.

As a child attending the 1996 Summer Olympics in Atlanta, he recalled admiring the uniformed service members and police. He told his father he wanted to pursue a career in law enforcement or the military.

It was a calling an improvised explosive device couldn’t shatter.

“I was given a second chance,” Ferreira said. “Not many people survive an IED blast like I did. I don’t want to be one of the guys who just kind of gives up on themselves.”