The alleged gunman who was shot by Lake Success police after robbing a Flower Hill T-Mobile store and attempting a carjacking as he tried to flee earlier this month was ordered released on $1 million bond Thursday.

Felquin Piedra, 41, of Queens, who was shot three times by police, appeared in U.S. District Court in Brooklyn on Thursday afternoon in a wheelchair before Judge Viktor V. Pohorelsky. The judge ordered Piedra to home detention, though he can be taken to doctor's appointments by either his mother, Anna Piedra, a registered nurse, or his girlfriend, Isabel Acosta, a Jet Blue flight attendant. He also must wear an electronic monitoring device.

Piedra's attorney, James Kousouros of Manhattan, told the judge his client was not being provided with proper medical care in the Queens detention facility where he's been held since the March 4 incident. Kousouros successfully argued for Acosta, 32, and a friend -- Louis Siquencia -- to put their homes up for collateral to cover the bond.

StoryFBI: Man robs T-Mobile store; shot by copsDataGun crime numbersPhotosRecent LI mug shots

Piedra, who lives with his mother in Bayside's Oakland Gardens and has worked as a print screener, is "still in excruciating pain," Kousouros told the judge.

Assistant U.S. Attorney Mathew Miller argued against the bond, saying that Piedra's injuries happened when he fled police and releasing him would essentially be a reward for the bad conduct.

"He was fleeing from an armed robbery . . . [and] jumped off the Long Island Expressway" Miller said.

advertisement | advertise on newsday

While the judge said Piedra's actions were "extreme acts of desperation," he said the bond was sufficient.

Piedra was charged with robbery, using a firearm in a robbery and attempted carjacking in the March 4 holdup at the Flower Hill T-Mobile and carjack attempt in Lake Success, authorities said.

According to an indictment filed in federal court Monday, Piedra and his alleged accomplice, Alexis Escobar, also robbed a T-Mobile store on Walt Whitman Road in Huntington Station on Nov. 4, 2014 and a T-Mobile store on Astoria Boulevard in Queens on Jan. 9, 2015. Escobar's attorney could not be reached for comment.

Piedra was tracked down the same night of the alleged Flower Hill heist on the LIE through a GPS tracker in a stolen item, then he jumped off an overpass and was shot by police during an attempted carjacking, according to an FBI complaint.