Sarah Sayeed, a member of Mayor Bill de Blasio's staff who serves as a liaison to Muslim communities, attended the rally.

"I understand the fear because I feel it myself," she said.

"I understand the anger. But it's very important to mount a thorough investigation."

The motive for the shooting was not immediately known and no evidence has been uncovered that the two men were targeted because of their faith, said Tiffany Phillips, a spokeswoman for the New York City Police Department.

'This is a hate crime'

The Council on American-Islamic Relations (CAIR), a Muslim civil rights and advocacy group, held a news conference on Saturday near the Al-Furqan Jame Masjid, where the two men had prayed.

Kobir Chowdhury, a leader at another local mosque, said: "Read my lips: This is a hate crime" directed at Islam.

"There is a deep sense of mourning and an overwhelming cry for justice to be served.

"There is a very loud cry, too, for the NYPD to investigate fully, with the total amount of their resources, the incident that happened today.

"We are calling for all people, of all faiths, to rally with compassion and with a sense of vigilance so that justice can be served.

"You can't go up to a person and shoot them in the head and not be motivated by hatred."

Mayor's statement

Eric Phillips, a press secretary for Blasio, said the mayor was closely monitoring the police investigation into the shootings.

"While it is too early to tell what led to these murders, it is certain that the NYPD will stop at nothing to ensure justice is served," Phillips said in a statement.

In June, CAIR issued a statement calling for Muslim community leaders to consider increasing security after the Orlando massacre and incidents that it said had targeted Muslims and Islamic houses of worship.

A man who called himself an "Islamic soldier" killed 49 people in an Orlando, Florida, nightclub on June 12.

Last year, three American students were shot to death at a residential complex of the University of North Carolina at Chapel Hill over what police had said was motivated by a long-running dispute over parking spaces.

However, the victims' families believe they were targeted because they were Muslims and have pushed for hate-crime charges.