New York City is home not just to a massive fleet of iconic yellow taxis, but to an amazing diversity of cab drivers.

Roughly half of the city’s 40,000-odd cabbies are Muslims who hail from countries all over the Middle East, Africa and elsewhere — and a great number of the drivers are observant, praying five times a day. Which raises the question: How and where do these men on the move pray?

When you spend your days driving a taxicab, it’s impossible to say where, at any given moment, you might wind up. Followers of Islam can perform their five daily prayers in any relatively clean space, even bowed down on the side of the road. But the process isn’t so simple. You first need to ritually wash with water and then to prostrate yourself facing east, toward Mecca.

“That’s why we have an app in our iPhone, we know where is the Mecca,” Youssef Kamal told me. “Right now, I’m here, right? I check my iPhone, check which is the Mecca. Straight to Mecca. Like, I am in Mecca right now. Technology!”

I found Kamal praying alone at the BP gas station on the corner of Houston and Lafayette streets. He'd taken a prayer mat from the cardboard box kept there for drivers, laid it down in front of the pumps and was kneeling in the cold.

It’s best to pray in a group led by an imam, but for a roving driver, that isn’t always a possibility.

“The prayer starts, like, at one o’clock,” said Kamal. “Now it’s 1:15. I’ve been looking for the parking since 12:40. I didn’t find no spot. I turned my wheels to the gas station to perform my prayer. Even, it’s not count 100 percent prayer because you have to be all together. Together is more credit, more reward, than single.”

Parking is the chief anxiety of every observant driver in New York. There are five daily windows for worship, some briefer than others. The prayer itself takes only 10 or 15 minutes to complete, but it must be done on time. Otherwise, it expires.

This is why religiously-committed cabbies will sometimes stop in front of hydrants, double park, triple park, forfeit fares and risk sizable tickets to stick to the day’s ritual schedule, especially on Fridays, when the most significant prayer of the week takes place.

Said Kamal: “We have to pray no matter what. Even you put it in double park. Even you put it in the bus stop. We have to go to pray. It’s like something mandatory.”

New York’s Muslim cab drivers have memorized a city-wide circuit of mosques and other, more makeshift, prayer spaces that do the job when one can’t reach a formal house of worship. Basements in South Asian restaurants. Backrooms in gas stations and auto repair shops. Certain parking lots. This way, the driver is prepared no matter where his next destination.

Cabbie 1: “OK, the big central one in 96th and 3rd Avenue. And you got one on Broadway, between Broadway and 5th Avenue on 29th Street.”

Cabbie 2: “A restaurant in 29th between 6th and 7th. That’s in the second floor, there’s a spot there where we can pray.”

Cabbie 3: “Sometimes some people are praying in gas stations. Like here; 2nd Avenue, 1st Street; 36th and 10th Avenue. Like this.”

Cabbie 4: “Sometimes I have a bag. You can open the bag to be a carpet, a prayer carpet, to pray anywhere. Anywhere. We have a little mosque in JFK — in the parking lot, taxi lot.”

Cabbie 5: “But at least the place is clean, we can pray anywhere.”

Cabbie 6: “Allah knows, God knows, how we do it, but people get it done.”

Yahia Nassar is headed to midtown because, well, I’m his fare and that’s where I’m headed. Our drive should take about 20 minutes.

“The next prayer is at sunset,” said Nassar. “It’s 10 minutes to five.” This means that Nassar has less than an hour and he doesn’t like to scramble. All focus should be on service to the divine, he says, not on an illegally-parked car.

“I’m telling you,” said Nassar, “if you have something, you’re leaving a car, and you’re afraid, you are concentrated five percent on the prayer, 95 percent on the car. Because this is human. A human is a human. He’s afraid about his properties, right?

"Illegal parking, it’s not worth it. It’s not worth it. Because if you go to pray and you get a ticket for $115. $115. $115, you can’t make it the whole day,” he added.

Once passenger-less, he’ll will switch the light on the roof of his cab off. “If you’re not off and somebody stop you, you can’t say no,” said Nassar. "So you have to be off-duty to control your time and to find a place to park. Then you go to pray, in peace.”

Nassar drops me at the midtown Mobil station at sundown. It’s pretty close to where I need to go. Outside, customers are pumping gas. It’s almost impossible to tell that, inside, dozens of taxi drivers are bent on their knees in prayer. The men typically worship in a small, cramped room at the back of the service area. But sometimes, like now, when there are no cars to be repaired, they spread their rugs over the entire garage.

The congested avenues, the seven-day work week and the cars, they leave worriedly behind them. The minutes before prayer time are frantic. But in prayer, all of this seems to die away and all that’s left are the demands of faith.

“If you lost the prayer,” said Youssef Kamal, “your day is gonna go, like, crazy. Because your mind is gonna be — one day it happened to me: I missed the prayer. I had no more chance. My mind, the whole day, it wasn’t properly.

"This is a time between you and God. It’s like a meeting. If you have a meeting with your boss, how would you feel? If he tells you to come at 8:30 p.m. or a.m. — you feel crazy, you take a taxi, take a subway, you run just to see the boss. Same thing.”