Bagpipes played and dozens of cops cheered as officer Michael Levay was released Friday morning, and his partner, officer Lukasz Kozicki, was released a few hours later.

Levay, 27, was shot in the back and Kozicki, 32, was shot in the legs and groin after they confronted a straphanger aboard a Manhattan-bound N train that was nearing the Fort Hamilton Parkway station, at Fort Hamilton Parkway and 62nd Street, about 7:30 p.m., according to the NYPD.

On his release from the hospital the next morning, Levay gave the jubilant crowd a thumbs-up and said simply, "Nice to be going home."

His father, Bob Levay, was overjoyed.

"I didn't get any sleep last night," the elder Levay said. "[But] right now, I feel great."

Kozicki was released later Friday. He was rolled out in a wheelchair and did not speak to the waiting crowd, cops said.

"I think he was feeling a little tired," said one officer who came to show his support for Kozicki. "It's been a long 24 hours for both of them."

On Thursday night, Levay and Kozicki, spotted a man, identified by police as 37-year-old Peter Jourdan, sit down after walking between two subway cars on the N train, police said.

The officers approached and asked Jourdan to produce identification, so he stood up. But instead of a wallet, Jourdan drew a 9mm Taurus handgun and fired at the officers, police said.

Levay was struck in the back, where he was protected by a bulletproof vest. Kozicki was shot three times, in both legs and the groin, police said.

Levay returned fire, killing Jourdan.

Police said Jourdan, who was living in a Chelsea hotel, had an extensive rap sheet, including arrests in New York for theft of service and assault and in Los Angeles for attempted robbery and criminal possession of a deadly weapon.

DNAinfo is New York's leading neighborhood news source. We deliver up-to-the-minute reports on entertainment, education, politics, crime, sports, and dining. Our award-winning journalists find the stories - big or small - that matter most to New Yorkers.