Under the glistening dome of a mosque on Long Island, hundreds of men sat cross-legged on the floor. Many were doctors and engineers born in Pakistan and India. Dressed in khakis, polo shirts and the odd silk tunic, they fidgeted and whispered.

One thing stood between them and dinner: A visitor from Harlem was coming to ask for money.

A towering black man with a gray-flecked beard finally swept into the room, his bodyguard trailing him. Wearing a long, embroidered robe and matching hat, he took the microphone and began talking about a different group of Muslims, the thousands of African-Americans who have found Islam in prison.

“We are all brothers and sisters,” said the visitor, known as Imam Talib.

The men stared. To some of them, it seemed, he was from another planet. As the imam returned their gaze, he had a similar sensation. “They live in another world,” he later said.

Only 28 miles separate Imam Talib’s mosque in Harlem from the Islamic Center of Long Island. The congregations they each serve — African-Americans at the city mosque and immigrants of South Asian and Arab descent in the suburbs — represent the largest Muslim populations in the United States. Yet a vast gulf divides them, one marked by race and class, culture and history.