Oscar Morel, 35, of the borough of Brooklyn, was charged just hours after hundreds of mourners gathered for the outdoor funeral of the two men on Monday.



The killings in the borough of Queens shocked the neighbourhood’s Bangladeshi community.



Morel was charged with two counts of second-degree murder in the deaths of Imam Maulama Akonjee, 55, and Thara Uddin, 64, on Saturday a spokesman for the New York Police Department said.



Morel was also charged with two counts of second-degree criminal possession of a weapon.



Robert Boyce, the New York Police Department's chief of detectives, told a news conference on Monday that surveillance video showed the suspect getting into a black GMC sport utility vehicle after the shootings.



That vehicle was then involved in a hit-and-run three miles away in Brooklyn shortly afterward.



After officers located the SUV, the suspect rammed a detective's car several times in an attempt to escape, but was arrested, Boyce said.



"Motive right now has not been determined. We're still drilling down," he said. Asked if it was being considered a hate crime, Boyce said that is "still certainly on the table".



"It's possible it's a hate crime, or some other motive," he told the news conference.



Asked about Morel's employment, Boyce said the suspect is believed to have worked at a warehouse in Brooklyn.



Akonjee and Uddin were shot in the head at close range after leaving Saturday prayers at the Al-Furqan Jame Mosque in the Ozone Park neighbourhood of Queens.



Police said there was no known connection between the man being questioned and the murder victims.

Mayor Bill de Blasio, addressing the funeral, promised the city would bolster the police presence in the neighbourhood even though the motive behind the killings was still unclear.



Police had said there was no evidence the men were targeted because of their faith but nothing was being ruled out.



Akonjee, 55, was a devout and humble preacher beloved by the area's Bangladeshi Muslim community, according to those who knew him. Many locals wondered what could have prompted his killing.



A father of seven, Akonjee emigrated to the United States from Bangladesh several years ago, said Badrul Khan, the founder of the Al-Furqan Jame Mosque.



He described the slain imam as a man who lived and breathed his religious faith.