Oscar Morel, 35, of East New York in Brooklyn, is facing charges of one count of first-degree murder, two counts of second-degree murder and two counts of second-degree criminal possession of a weapon.
If convicted, Morel faces up to life in prison without parole.
He pleaded not guilty at the arraignment.
The 35-year-old's attorney says his client denies the allegations. Morel's family members declined to comment.
Police said surveillance video shows Morel running up behind 55-year-old Imam Maulama Akonjee and 64-year-old Thara Uddin, who were leaving a mosque in Ozone Park around 2 p.m. Saturday.
The men were both shot in the back of the head as they walked near the corner of Liberty Avenue and 79th Street.
Watch the video here:
More than a dozen members of the victims' mosque attended the court proceeding, including the imam's son and Uddin's brother.
"I loved my father, my father was a good guy," said the victim's son, Saif Akonjee. "I don't know why he gonna kill him, but now I want justice."
Police have not called the murders a hate crime as they continue to investigate the suspect's motive. Both men were wearing traditional religious attire, and Akonjee was carrying about $1,000 in cash that was not taken.
"While the motivation for this violent act is still unclear and continues to be investigated, one of the possible motives being explored is whether this was a hate crime," said Queens District Attorney Richard Brown.
Authorities had previously released a sketch of the person they were looking for, seen leaving the scene of the double murder in a Chevy Trailblazer.
In court, prosecutors said Morel admitted he owned the Trailblazer.
Police said the person behind the shooting also struck a bicyclist with that same vehicle sometime over the weekend and then fled the scene.
The vehicle is what led police to Morel. The bicyclist had managed to get his license plate number, which helped police track him down shortly before midnight.
"Detectives from the Fugitive Task Force Unit approached the car, and then he rammed the detectives' car several times in an effort to get away," said the New York Police Department's chief of detectives, Robert Boyce. "He was placed under arrest without any further incident and brought back to the precinct for more debriefing."
Here's video of the NYPD walking Morel to a police cruiser:
During a search of Morel's apartment, police recovered a revolver, pictured below:
Prosecutors say the bullets are an exact match to the gun they recovered, that a witness identified Morel as the gunman, that he was seen from "numerous cameras in the area", and that Morel admitted he was at the scene.
Morel is due to return to court on Aug. 18, at which time a homicide attorney will be assigned to represent him.
The Associated Pres contributed to this report.