Murtala Muhammed International Airport is a rough place with a worse reputation. The main entry point into Lagos, Nigeria, it’s teeming with pickpockets, con men, corrupt officials, and assorted other predators. This is where the so-called “underwear bomber” started his journey to the U.S.; it’s also where, following a rash of armed robberies, police were given clearance to shoot suspects on sight. For years, the FAA didn’t even allow American planes to land here because it was too dangerous. It’s still the only airport in the world for which the State Department has issued a specific criminal warning.

The guy who got me was wearing a tie and a badge. I’d just cleared customs and was heading for a taxi when he stopped me and asked for my yellow-fever card. I told him the Nigerian Embassy had said I wouldn’t need it. He shook his head. “Now you must go to the clinic,” he said. “The shot will cost $160. It will take about six hours.”

The only thing less enticing than getting stuck with a needle at an airport clinic in Nigeria is paying $160 for the privilege. I started to walk away; he threatened to have me arrested. We went back and forth for a few minutes, and then he softened. “Or we could sort it out here. What would you like to do?”

I slipped the cash inside my passport. “Next time,” he said, as he palmed it, “bring your certificate.” He nodded curtly. “Welcome to Lagos.”

Although it’s one of the biggest cities in the world, Lagos remains a mystery to most Westerners. There aren’t any sights to speak of and almost no tourists. The few foreigners who do come are either businessmen chasing the oil that fuels the country’s economy or diplomats working to hold together a country that religious violence currently threatens to rip apart. “Only a masochist with an exuberant taste for self-violence will pick Nigeria for a holiday,” author Chinua Achebe wrote. “[It] may be a paradise for adventurers and pirates but not tourists.”

Which is exactly why I wanted to come. I’d heard stories of wild things in Lagos: highwaymen, floating slums, gangsters walking leashed hyenas through the streets. A friend whose dad did business there in the 1980s said it was the most unruly place he’d ever been. Another friend, who’d lived in South Africa for a decade, said that even most Africans were afraid to go. The World Bank’s lead economist for Nigeria called the country a “time bomb.”

In the past five years, Lagos has exploded. Current estimates put the population somewhere between 15 and 18 million, with an annual growth rate of around 6 percent – one of the fastest-growing cities on the planet. By 2025 it’s expected to top 25 million, making it the third-largest city in the world, after Mumbai and Tokyo. The result is a place stretched to its breaking point: a Dickensian conurbation of overcrowded slums and nonexistent services. It’s also in some ways a city of the future: what happens when democracy, industrialization, and unchecked population growth collide in the developing world.

Of all the problems facing Lagos, the worst might be traffic. Traffic in Lagos is a force of nature – a phenomenon as destructive and inevitable as the rains that blow in every March. “There is no weekend for traffic in Lagos,” one resident told me. “Traffic is every day.” Lagosians have words for traffic the way Eskimos have words for snow: congestion, logjam, lockdown, holdup, gridlock, deadlock, and the wonderfully evocative go-slow. Horror stories abound: police attacking motorists with bullwhips, taxi drivers getting into fistfights, angry commuters backing over policemen with their SUVs. I came to try to navigate the turmoil – to get an on-the-ground look at life in a modern African megacity in all its chaotic glory.

“When it comes to chaos,” Toyin Falola, author of several books about Nigeria and Lagos, told me, “no place can compare. Lagos sets its own rules. But if you can figure out its logic, there is a beauty to it.”

The first morning, I started getting to know Lagos the only way you really can: by driving around. I met the man who’d agreed to be my guide, a short, stout 30-year-old by the name of Sunday. He had a winning smile and a two-inch scar running vertically under each eye, a ritual marker of his tribe in Ogun State. We got into his car, a silver 2002 Toyota Camry with a gold rosary dangling from the rearview, and started driving.

My first impression of the city was that it’s supremely flat. It’s built on a huge mangrove swamp, with no point more than a few meters above sea level. The Portuguese named it Lagos after the lagoons that make up a quarter of the city – its official nickname is Land of Aquatic Splendour – but from the road, it seemed clay colored and endless. Fires burned in the slums, covering the city in a brown perma-haze. It was harmattan, the midwinter season, when hot, dry winds blow in from the Sahara, coating everything in a layer of dust.

It’s also incredibly loud. Lagos’ roads are a cacophony of honks, bleats, screeches, and roars. There are motorcycles with horns tricked out to sound like 18-wheelers, muezzins on loudspeakers issuing the call to prayer, arguments everywhere: motorists arguing with bus drivers, street vendors arguing with customers. At one checkpoint, a policeman with a rifle argued with a soldier with a machine gun. It was hot, maybe 90 degrees, but Sunday didn’t want to turn on the A/C. “It uses too much fuel,” he said.

For decades, one of the few perks to living in a country so overwhelmingly poor yet petroleum-rich was access to cheap gas: Ever since oil was discovered near a creek in the Niger Delta, in 1957, the government had used subsidies to keep gas prices low. As recently as December, Nigerians could fill their tanks for about $1.60 a gallon – not exactly cheap in a country where the average daily wage is about $3.25, but not crippling.

Then on January 1, Goodluck Jonathan, the country’s much-maligned president – his nickname is Gridlock – declared an end to the subsidy: Nigeria was facing a $5 billion deficit and couldn’t afford a program that ate up a quarter of the national budget. Gas prices doubled overnight. Even worse, because most Nigerians get their electricity not from the failed public grid but from their own diesel-powered generators, millions of Lagosians literally could no longer keep the lights on.

The opposition organized nationwide strikes, and the chaotic streets of Lagos turned into a ghost town. Protesters shut down the airport, grounding all flights in and out. Finally, after a week, the government agreed to compromise. When I arrived a few weeks later, things were back to their typical state of surreal. For instance:

• a minibus taxi (commonly known as a danfo) flying down the highway at 65 miles per hour with a man hanging on to the back by his fingertips

• a danfo driver and a BMW owner getting into a fistfight after a fender bender at an intersection

• a traffic warden in a fluorescent vest trying to stop an okada (motorcycle) driver and getting run over for his trouble

• a police officer, his AK-47 slung over his shoulder, unzipping his pants and taking a piss on a concrete wall, right under a hand-painted sign that said “Nigeria Police”

There are only 68 working traffic lights in the city. Libertarianism prevails: One-way roads are mere suggestions; stop signs are routinely ignored; the speed limit is nonexistent. Accordingly, accidents are routine. Near the Falomo Bridge, a Mitsubishi Montero backed into an okada hard enough to dent its bumper, an occurrence so commonplace that neither driver bothered to stop. Later, on the highway, a man ran in front ofSunday, who slammed on his brakes with feet to spare. “A lot of people die in this place,” he said.

Sunday tuned the radio to a show called Tell Me Your Place. Without satellites or traffic helicopters, Lagosians rely on each other. If you’re stuck in traffic, you call the show, and the DJs report where things are backed up. It’s a low-tech version of crowdsourcing – a real-world traffic wiki.

Lagos is full of solutions like this. At one point, on a main road called Awolowo, traffic got so bad that the westbound cars collectively decided to colonize one of the eastbound lanes. Instead of two lanes in either direction, it turned into one and three. But no one seemed to mind. The city was sorting itself out.

From above, Lagos sort of makes sense: the kind of macrolevel organization that the architect Rem Koolhaas, a frequent visitor to Lagos, calls, in his documentary Lagos Wide & Close, “the human swarm.” But as the writer George Packer has said, “People live at ground level, and at ground level, Lagos is a pretty hellish place.” There’s garbage everywhere, clogging gutters and littering streets. At roadside dumps, trash pickers scavenge old plastic and rags from refuse piles a hundred feet high. Many sections of the city are controlled by so-called “area boys,” gun-toting gangsters even the police don’t mess with. An American diplomat told me about the day he hit a dead body on his way to work: On his way back home, it was still there.

One morning, I paid a visit to a slum called Makoko, in the shadow of the massive Third Mainland Bridge. Because the city is so short on space, the poor have had to adapt. Makoko is built on the water: 300,000 people, mainly immigrant fishermen – just some of the 6,000 people who move here every day – live in thatched-roof shacks on stilts over the lagoon.

On the shore, a group of about 10 of us climbed into three wooden dugout canoes and paddled out. The water was black and smelled of refuse and human waste. (Koolhaas says the first few times he saw Makoko from the highway, he thought it was a dump.) The slum sits next to a sawmill, called Okobaba, and on the water were thousands of logs, floated from rivers all over West Africa. Nearby, shirtless men cut timber with band saws, raw material for people building more.

Nigerians are used to going without services – one joke says that the initials of the national power company, PHCN, stand for “Please Have Candle Nearby.” But Makoko is extreme. There are no police, no hospitals, no public electricity. The only fresh water comes from a communal tank that the residents fill themselves, and the only time anyone from the government visits is during elections. Still, they’ve managed to build an entire shadow city, complete with churches, mosques, schools, barbershops, and even bars.

Our guide was a man named Joseph, who worked as a director at the sawmill. He talked to us as we drifted through the labyrinth of stilts, past children in blue school uniforms who waved as we passed, shouting “Oyibo!” – white man. Occasionally we would bump into another canoe, a young girl selling rice or detergent, or a woman hauling fish.

But at any moment, things can tip. After we’d been paddling for about an hour, a fisherman on some nearby rocks started yelling at us, demanding to know what we were doing. Suddenly, one of the men accompanying us peeled off his shirt and jeans – underneath was a woman’s one-piece swimsuit – and waded over. After a brief, heated argument, he shoved the fisherman to the ground and started kicking him in the face. Another man picked up a stray two-by-four and broke it over the man’s head.

Eventually they let the man go, and he limped away. “This man is a foreigner,” Joseph explained, back in the boat. “He cannot tell us what to do. This is our country.”

Later that afternoon, I visited a market called Idumota, on Lagos Island, the beating heart of the city – as my guidebook put it, “one of the most frantic and densely packed areas of Africa, if not the world.” This is the original site of Eko, the Yoruba fishing village that modern Lagos was built on.

They sold everything at Idumota: canned beans, eyeglasses, welcome mats, wedding dresses, combination locks, kola nuts, Yankees caps, diapers, bras. In the parking lot behind the mosque, you could buy a fake passport for $30. Another block was devoted entirely to cheap DVDs. (Nigeria’s movie industry, known as Nollywood, is the third-largest in the world.) On one corner, a meatmonger unrolled a large sheet of butcher paper on the sidewalk, then filled it up with an assortment of kidneys, livers, tongues, and penises. Over in the juju (witchcraft) market, milk-eyed old women sold everything from dried frogs to monkey’s paws to live doves and cats. Sometimes there were reports of human body parts.

At one point, the photographer for this story and I climbed onto a pedestrian bridge to get a better look. We’d made it about halfway across when two area boys came up from the other side. “You cannot be here,” one of them said. “You have to talk to security.” OK, we said. Who is security? He gestured to his friend: “We are security.”

Before we knew it, the two had become four and then eight and then a dozen. We were surrounded. “You have to pay,” said one man in sunglasses who seemed to be the leader. “For taking the pictures.” We asked how much, and he said 50,000 naira – about $300. I laughed and told him I only had 2,000, and he shook his head. One of the men grabbed for the camera.

Below us, Sunday was honking his horn and shouting for us to get down. “These are the bad men of Lagos,” he explained later. “The law means nothing to them. They will hurt you, and they won’t get caught.” In the market below, two policemen were watching everything unfold.

A negotiation followed, and a price was settled on. The man in sunglasses smiled, and we all shook hands. “This,” he shrugged, “is how it works here.”

Some people in Lagos actually like traffic. First are the hawkers, street kids who make a living selling everything from toothbrushes to machetes to shoes. Then the mechanics, who work the roadsides like pit crews with jumper cables and wrenches. At a few intersections, there were beggars, crippled polio victims scooting around on skateboards, or old albinos shielding their eyes from the sun. But most Nigerians work hard for their money, juggling two, three, sometimes four jobs at once. “That’s what I love about Nigerian people,” said Sunday, whose side hustles included taking paparazzi shots and selling black-market gas. “They don’t wait for someone to give. They go and get.”

And then there are the police. There are at least five different authorities responsible for Lagos roads, and all of them are corrupt. At the top are the federal police, who wear all black and carry AK-47s. Next is the FRSC, the Federal Road Safety Commission, who dress in khaki and oversee police checkpoints. The vehicle inspection officers, or VIOs, wear white and watch for broken taillights or seatbelt-less drivers, while the traffic wardens, in orange and black, theoretically oversee the intersections but usually just sit around looking bored. The KAI, in lime green, are environmental officers: As Sunday put it, “If you wee-wee in the street, they will arrest you.”

Most ubiquitous is the LASTMA – the Lagos State Traffic Management Authority. Its purview is anything that impedes the flow of traffic: broken-down cars, wayward pedestrians, unlawful parkers. One afternoon, on a highway median in northern Lagos, I met a LASTMA officer named Olayinka John Obasa – Yinka, for short. Obasa said he was proud of the work he did: “I feel like I’m saving lives, securing property. I feel like I’m helping.” At the same time, he said, though he made, by Lagosian standards, a pretty good living (about $260 a month, twice the civil servants’ minimum wage), bribery was still a fact of life. “If someone offers me money to avoid a ticket,” he admitted, “I’ll take it. I’m being blunt with you. I am a Christian, and sometimes I pray to God that something will break down and someone will have to pay.”

Nearby on the same median, an ambulance was parked. Because traffic is so bad in Lagos, the government has ambulances stationed throughout the city so they can reach emergencies faster. This was Point 1. In the back of the ambulance sat two nurses: Esther, who was filing her nails, and Abesidi, who was reading a gossip magazine. Up front, their driver was taking a nap.

Esther and Abesidi said they got their last call a week ago, when a commuter van flipped over on the highway during rush hour. Eight people went to the hospital; one of them died. I asked if they’d ever had patients die in the ambulance because they were stuck in traffic, and Abesidi nodded. “We use the siren and the lights,” she said. “But it’s very difficult.”

Esther estimated that 90 percent of accidents were caused by okadas and danfos. “The okadas are the worst,” she said. “Sometimes you get on and you can smell the drink on their breath.” There are stories of okada drivers having their legs sheared off, of passengers being killed. In Lagos, emergency rooms are known as “okada wards.”

Just then, Esther’s walkie-talkie crackled. There was an accident nearby. “Do you want to come?” she asked. They climbed up front and woke the driver, and I jumped in the back. The driver turned on the siren and pulled onto the highway.

We wailed down the highway for a few miles, scattering traffic as we went. I sat in the back with the needles and bandages, simultaneously thrilled and frightened by what we might find. But then, just as suddenly, the siren shut off. Esther turned around. “Sorry. False call.” They drove back to the checkpoint and resumed their wait.

Later that night, I needed to cross the Falomo Bridge, a mile-long span between two of the city’s islands. Normally okadas aren’t allowed to cross it at night, but I found one driver who was willing to take me. He was small and wrinkled, and at least 65. I climbed on the bike and held on tight.

Riding through Lagos on an okada at night is a thrilling thing. The wind battering your face, the smell of the Atlantic on the air, the nagging feeling that the next moment might be your last. Halfway across, the driver gunned it, and for a moment, the whole city melted away.

When we reached the police checkpoint at the far end of the bridge, I braced for trouble. But the officers saluted and waved us past. When the wind died down, I asked him why. “Because I’m a soldier,” he said.

His name was Col. Franc Akban. He was born in 1944 and joined the army as a teenager, serving as a munitions specialist in the Biafran War. But then, he said gravely, “I had a terrible accident.” He didn’t say how, only that his legs were mangled and he needed several surgeries to put them back together. He had to leave the army and moved to Singapore to be a chef; he had moved back to Lagos nine years ago to be with his children.

He worked mostly for tips: 100 naira here, 200 there (60 cents, $1.20). Sometimes he missed cooking, he said, but mostly he was glad to be back with his family. “I don’t make much. But it’s a good life.”

Meanwhile, there’s another side to Lagos – one of exclusivity and wealth. One afternoon I went to a talk at the Center for Contemporary Art, a small gallery with bare white walls. The topic was the recent fuel protests, which everyone agreed were the most successful ever. There was talk of Tahrir Square and Occupy Wall Street and of the transformative power of Facebook and Twitter. Afterward there was a reception, with coconut shrimp hors d’oeuvres and palm wine in crystal stemware.

That night I dined on catfish and pepper soup with two of the panelists. Toni Kan was a former poet and novelist who now worked in public relations. His friend Victor Ehikhamenor was a soft-spoken creative director who’d studied literature and technology management at the University of Maryland. They both had plenty of problems with the government and the city, but they still liked Lagos for the opportunities it provided. Toni said he didn’t pay taxes at all last year, and no one would ever bother trying to collect them. They both frequented the Ikoyi Club, where politicians and generals played squash and golf while blue-uniformed guards watched their Range Rovers. They also liked a beach called Tarkwa Bay, nestled in a cove a 15-minute boat ride from the city, where you can watch kids play soccer in the surf while sipping cold beer and eating the most delicious bananas you’ve ever tasted.

After dinner, Toni lit a Dunhill and eyed me through a cloud of blue smoke. “I see you getting four wives here,” he said. I told him that sounded like a lot.

“My grandfather had eight wives,” said Victor. “And he lived to be 103.” (Victor, meanwhile, had one ex-wife. “In Dallas,” he said, smiling.)

One night I went out with some employees from the U.S. consulate. We ate at a Mexican restaurant on Victoria Island where a pitcher of margaritas costs $25 and a band played bad Elvis. They were in their twenties and seemed excited to be in Lagos and ready to leave. They didn’t interact with the locals much; they took armed guards to markets and weren’t allowed on the mainland. They spent most of their downtime at restaurants like this, or playing soccer against the British in a compound surrounded by razor wire.

Later we had drinks at Ember Creek, a bar near the Lagos Boat Club popular with diplomats and oil executives. It was a breezy night, with Christmas lights strung through the palm trees and a swimming pool that glowed electric blue. On the water was a massive yacht whose owner had bought it off the set of the last James Bond movie. When the lights went out, as they often do in the city where some residents are lucky to get two hours of electricity a day, everyone cheered.

For a while in the 1970s, when wealth and national pride were at an all-time high, Lagos was a bohemian mecca. It had an exotic cosmopolitanism and a killer music scene: Cream’s Ginger Baker owned a studio here, and Paul McCartney came here to record Band on the Run. (Apart from getting robbed at knifepoint, he had a great time.)

The scene has dwindled since then, surviving mainly in tucked-away places like a Portlandesque record store called the Jazz Hole, or Bogobiri House, where fashionable young Lagosians smoke imported cigarettes and do graphic-design work on their MacBooks. But it’s still there if you know where to look.

One night I visited the home of a musician named Seun Kuti. Seun, 29, is the youngest son of the late Fela Kuti, a titanic figure in Nigerian music. Fela invented the genre called Afrobeat and, with his band Egypt 80, spread it all over the world. Seun has led the band since he was 14, following his father’s death.

Seun lived on a quiet street in the suburbs, in a three-story house with a Mercedes SUV in the driveway. He had a show that night, and when I arrived he was still upstairs getting dressed. In the living room, his entourage was sitting on a pair of leather couches, watching Scare Tactics on a flatscreen.

“Hello, welcome!” said a kindly, white-haired old man who greeted me. He held out his hand. “My name is Priest David, but you can call me Papa D. Where are you from?”

I told him New York. “Ah, New York!” he smiled. “I lived in New York from 1974 to 1981. Avenue C and 6th Street. Tell me, is Studio 54 still there?” I told him that unfortunately it closed about 20 years ago. “Oh, that’s a shame,” he said. “The owner, Steve Rubell, was a good friend of mine. We used to go there with David Bowie.” He reached into his shirt pocket and pulled out a joint. “Tell me, do you smoke ganja?”

Seun came downstairs about a half-hour later wearing a crisp purple shirt and a saxophone strap. He was trim and handsome, the spitting image of his dad. A big mastiff-looking dog was plodding behind him. “That’s Vybz,” Seun said. “He’s a Boerboel. They were bred by South African farmers to attack blacks, but I’m training him to bite white people instead.” He looked down at Vybz, who was licking my hand. “I guess it’s not working.”

We drove through a neighborhood of discos and fast-food joints, passing several prostitutes along the way. (Sunday said they were called one-five girls because they cost 1,500 naira – about $10.)

The show was at a club called the Shrine, which used to be Fela’s old headquarters. It was a massive place, the size of a large warehouse, with pool tables, a dance floor, go-go dancers, and several bars. In the back, some food stands sold suya, a kind of Nigerian shish kebab, and sweet palm wine, a frothy drink made from palm-tree sap. Seun played for more than two hours, fronting a 12-piece band with three bikini-clad backup singers that only got tighter as the night went on.

In the Mercedes on the way home, he drove fast and swigged palm wine from the bottle. A man whipped past us going the wrong way. “Look at this animal!” Seun exclaimed. “He’s trying to get himself arrested! If you want to break the law, don’t break it big,” he smiled. “Break it small, like me.”

Seun was born in Lagos and had lived here all his life. Though he’d spent time in New York, London, Paris, and Berlin, he always came back. “If you don’t know anyone in Lagos,” he told me, “then don’t come to Lagos. But if you have friends here, Lagos is the best place in the world. Lagos is a hustling city. Lagos is alive.”

The next morning, I woke in the guest room to the smell of the Colonel’s Secret Recipe. Seun and a friend were downstairs on the couch, eating KFC and watching the Australian Open finals. Seun was wearing an Arsenal jersey with his nickname – shots – printed across the back. Vybz was on the floor, hoping for some chicken. After a while, we headed out for a tour of Fela’s old compound.

It’s nearly impossible to overstate Fela’s importance in Nigeria. Imagine a combination of James Brown and Malcolm X, and you’ll have some idea. An outspoken government critic, he was arrested more than a dozen times, usually on trumped-up charges. In one gruesome raid in 1977, a thousand-man army platoon raped Fela’s wives (he had 28), set fire to his studio, and beat Fela so badly that he was hospitalized with a fractured skull. They also threw his 77-year-old mother out a window; she later died from her injuries.

The compound, which Fela dubbed the Republic of Kalakuta, is three stories tall, surrounded by a cement wall topped with shards of green glass. When we arrived, an older woman in a headwrap was standing on the front steps. “Hey, Mama!” said Seun. “This is my stepmother Najite. She was one of my father’s dancers.” She lived in the compound with her daughter Motun, Seun’s half sister. A dusty display case in the entry held several of Fela’s shoes. Seun’s office was on the second floor, along with a music room where his band was rehearsing. He watched them for a while, checking Twitter on his phone and occasionally looking up to correct a mistake.

Traffic was a frequent subject for Fela. In his song “Go Slow,” he used Lagos’ congestion as a stand-in for the hopelessness of Nigerian life. In the 30-minute epic “Confusion Break Bones,” meanwhile, the traffic on Ojuelegba Street – a chaotic intersection near the heart of town, with no traffic warden and no stoplight – serves as an allegory for the whole broken country:

Moto they come from east

Moto they come from west

Moto they come from north

Moto they come from south

And policeman no there for center Nah, confusion be that.

Fela died in 1997, of complications from AIDS. Nine days later, his body was put in a glass coffin and driven through the city for people to pay their final respects. All of Lagos shut down; a million people filled the streets. “There was a lot of traffic that day,” Sunday said.

I was running late to meet the commissioner. Thanks to a gas shortage and the most hellacious traffic yet, by the time I arrived at the state government offices – a forbidding complex with the vaguely Orwellian name of the Secretariat –for my meeting with the Commissioner of Transportation, I was nearly two hours late. Muslim men knelt on prayer rugs in the parking lot, and in the air was the familiar lethargy of bureaucracy at work.

Upstairs, a secretary ushered me into an air-conditioned office, where the Honorable Mr. Kayode Opeifa was waiting. He was wearing black glasses, a pink dress shirt, a jacket, and no tie. A framed picture of himself hung on the wall behind him, and a large orange traffic cone sat on the floor beside his desk.

The commissioner asked his secretary for a glass of Coke. “So,” he said, leaning back in his chair. “How was your drive?” I told him about the traffic, and he nodded. “Yes,” he said knowingly. “There was an accident. A danfo conductor died.”The commissioner came to traffic in a roundabout way. He grew up near Ojuelegba – the intersection Fela sang about – and earned his Ph.D. in toxicology at the University of Lagos. Then in 1997, with the military in power, he fled. He moved to Chicago and worked for Abbott Laboratories. After the dictator Sani Abacha died in 1998 (supposedly from a heart attack, though many suspect he was poisoned by one of the six teenage Indian prostitutes with him at his death), Opeifa eventually came back from exile.

For a long time, the government had no traffic plan. But the general sense now is that it’s trying. Last November, Governor Babatunde Fashola personally led a team of police to arrest lawbreakers on a Lagos bridge. Mandatory psychiatric tests for wrong-way drivers on one-way streets have been instituted, though many suspect it’s just another ploy to get money.

The commissioner had several new ideas to improve Lagos traffic. Many of them seemed wildly optimistic: a computerized command center, a $3 billion light-rail, smart cameras at every light. Others, like an FM station devoted solely to traffic reports, seemed sensible and achievable.

Still, he suggested, some of Lagos’ problems might be intractable. At one point, he made a list of everything the city was lacking: 1,300 new buses, more than 300 new roads, countless pedestrian bridges. There were also far more cars than the infrastructure could handle, with more coming every day. “And still we manage,” the commissioner said. “Do you know what I call that?” He peered over his glasses and smiled. “A miracle.”

So far, Lagos had been more complex than advertised – frantic and challenging, but also surprisingly safe. But the thing about time bombs is, sooner or later they’re going to go off.

On my second-to-last day in the city, Sunday and I enjoyed a lunch of pounded yams and a kind of bush meat called grasscutter. (“It’s like a rat, but bigger,” he’d told me. It tasted like chicken.) Afterward we caught a soccer game, Lagos Mainland vs. Lagos Island. On the way out, we bought a Fela CD to listen to in the car.

It was one of those heavy Lagos afternoons, hot and unyielding. Our windows were down, and I could taste the fumes at the back of my throat. We drove through Lagos Island listening to Fela sing about government repression. Sunday pointed out the place where some area boys had rioted a few days before. Broken glass still littered the street.

It was about 5:45. The sun was starting to set. I was going to take a danfo back to my hotel, so we pulled into a motor park called Obalende, where hundreds of buses, taxis, and okadas were lined up, waiting to shuttle people home. Sunday parked at the curb, and I started to collect my things, but as I double-checked some last details, I must have taken a few seconds too long. A police officer strode up and planted himself in front of the car, then pulled out a digital camera and started taking pictures of Sunday’s license plate. Under his left arm, he had a metal baseball bat.

Sunday, incensed, got out of the car. “Why are you taking pictures? Tell me what I’ve done.” The policeman pointed to a sign: NO STOPPING. NO WAITING. Sunday continued to protest, and the cop snapped a few more photos, then walked over to the passenger door, opened it and got in.

This is how arrests work in Nigeria. Because cops don’t have cars of their own, they sit in yours and demand to be taken to a station. They don’t really want to go anywhere; they just want money. But Sunday, knowing he was in the right, refused to budge.

The cop got back out of the car. His partner came to take his place. The second cop was huge – probably 6-foot-6 and 250 pounds. He was so tall he couldn’t fit inside the Camry and had to crane his head out the window.

As the first cop and Sunday resumed their argument, a young boy on an okada pulled up. He couldn’t have been more than 16, maybe 17 at the most. He was trying to go around, but the policeman was blocking his way. So he waited patiently for about half a minute, and then finally, very carefully he tried to squeeze past.

It’s unclear if he accidentally bumped the cop or just annoyed him. Either way, the policeman exploded. He brought his bat – it was an Easton – crashing down onto the motorcycle’s dashboard, shattering the glass. The boy, horrified, tried to speed up, but the cop swung again, nailing him on the arm and almost definitely breaking his wrist. The boy screamed and pulled away, and as he passed, the cop took one last swing. This one hit him square in the back.

With a crippled right arm and likely a few broken ribs, the boy couldn’t control the bike. He wobbled on for a few pathetic feet, then went crashing headfirst into a concrete divider. The look on his face as he fell was a terrible mix of bewilderment and pain. The okada fell to the ground, pinning him underneath, and he lay there crying, literally in a pile of trash.

For a brief moment, no one moved. Then the crowd erupted. They started shouting at the policeman – the boy hadn’t done anything, he needed help. The policeman told them to calm down and go back to their business. Then a couple of okada drivers, famous for sticking up for their own, got off their bikes and got in the policeman’s face. Cornered, he took another swing, but this time someone ripped the bat away.

Now the policeman was unarmed and surrounded by a hostile crowd. He started shouting to his partner: “Call your man! Call your man!”

The big cop pulled out his cellphone and yelled something about the bridge, and within seconds, automatic gunfire sounded through the market. Two federal policemen with pistols and machine guns came sprinting toward the bridge, weapons drawn. They weren’t shooting into the crowd, exactly, but they also weren’t shooting straight up. The big cop got out to help his partner. A woman grabbed me by the arm. “You need to leave this place now,” she said. Sunday jumped in and started the car, and we nosed our way through the crowd and onto the road. And then immediately got stuck in traffic.

As we sat there, Sunday fumed. “This boy did nothing. Nothing! That policeman nearly killed him.” His voice grew quiet. “Sometimes I hate this country.”

The Fela CD was still on the stereo. Sunday reached down and turned it up. The song was called “Sorrow, Tears and Blood.” Fela had written it in 1977, after the police raid that killed his mother.

Everybody run run run, he sang,

Everybody scatter scatter …

Someone nearly die …

Police dey come, army dey come

Confusion everywhere

I looked over at the driver’s seat, and Sunday was close to tears. He sang along:

Policeman go slap your face

You no go talk …

Them leave sorrow, tears, and blood

Them regular trademark

By now traffic was at a standstill. We hadn’t moved for several minutes. Behind us, a woman in a Mercedes got tired of waiting and tried to go around. As she pulled into the opposite lane, her car stalled and died. Now traffic was stopped in both directions, and the street was fully locked down. There was nowhere for anyone to go.

My last night in Lagos, Sunday and I went to see Seun’s brother Femi play at the Shrine. We ate goat-meat suya and drank palm wine, and watched as a young woman in khaki short-shorts shook her ass in a cage. Sunday took pictures with my camera and made me promise to email them to him.

On our way to the airport, we found ourselves stuck behind an old man in a Nissan, driving very strangely. When he needed to merge, he slowed down. At stop signs, he came to a stop. After a minute or two, Sunday lost patience. “What is wrong with this man?” he said. “Has he lost his way?” He honked and went around.

But the image I’ll remember most came one afternoon in the Ikeja market. It was a typically anarchic Lagos afternoon – growling engines, blaring horns, bumping, shoving, shouting, smoke, exhaust, sweat, heat. All of a sudden, without even a drop of warning, it started pouring down rain. Everyone in the market scrambled for cover: ducking inside shops, huddling under awnings. The honking stopped. The shouts turned to whispers and giggles. The loudest sound was raindrops hitting the dirt.

The lull lasted for five idyllic minutes. Then, as quickly as it had come, it was over. The rain began to let up. People started trickling back into the streets. And Lagos took a deep breath, started its engine, and came rumbling back to life.

For access to exclusive gear videos, celebrity interviews, and more, subscribe on YouTube!