The Yonkers cop who was shot in the face during an ambush Monday left the hospital to the cheers of fellow officers — as it emerged Tuesday that the teen who allegedly blasted her was free thanks to a Bronx judge’s leniency.

Kayla Maher, 26, a two-year veteran, rose from her wheelchair at the exit of Jacobi Medical Center at 4 p.m. and hugged several of her colleagues, including some who had been with her during the shootout Monday.

Maher — whose mom, Susan Barry, is a retired NYPD officer — wore a New York Yankees shirt and a small white bandage on her chin, where she was struck by a bullet that cops say was fired by 18-year-old Frank Valencia of New Rochelle.

Valencia was hit in the ensuing gun battle with cops and was left in critical condition at a local hospital.

Maher is expected to make a full recovery.

“She is gutsy and you can see it, and she is certainly what we have come to expect from our department,” said Yonkers Mayor Mike Spano.

Meanwhile, disturbing new details emerged about a court decision that allowed Valencia to remain free despite being caught with a large cache of weapons earlier this year.

According to the Bronx district attorney, Valencia had been released by a judge a week earlier in a case involving his possession of a semi-automatic handgun, 300 rounds of ammunition plus a machete and a set of brass knuckles.

Cops found the weapons on him when they stopped him May 31 outside a White Castle on Fordham Road in the Bronx.

Because Valencia was 17 at the time, Judge George Villegas of Bronx Supreme Court gave him a sweet deal at his Sept. 20 sentencing, in which he received only probation and youthful-offender status.

“We objected to the plea being offered, because we would never have offered a non-jail deal in this case,” said Bronx DA spokesperson Patrice O’Shaughnessy.

Valencia had a .40-caliber Glock in his hand Monday when Yonkers cops responded to a call that he and a buddy were in a car blasting music near the corner of Rumsey Road and Park Hill Avenue in Yonkers, according to police.

Yonkers Police Commissioner Charles Gardner said Valencia “opened fire with no warning at point-blank range.”

“The bravery and courage shown by our officers last night was nothing short of heroic,” he said. “I’m very, very proud of you.”

Additional reporting by Linda Massarella