OUAGADOUGOU, Burkina Faso — When he moves to the drumbeat, he forgets the corpses. He forgets the darkest hours of a life spent running from terrorists who destroyed his childhood home and now threaten to seize his haven.

When 18-year-old Amiri Ag Abdoulaye closes his eyes, he’s onstage in Paris or New York.

“I forget where I am when I’m dancing,” said the refugee of eight years, whose passion is also his master plan. “It’s how I’m going to get out.”

Fighters linked to the Islamic State and al-Qaeda have forced his family and millions of other people from their rural homes, killing thousands in an increasingly bloody campaign to build a vast new stronghold in West ­Africa.

Burkina Faso, a farming country of nearly 20 million, is falling to the extremists at an alarming pace, with violence erupting in new parts of the north and east seemingly every week, emptying village after village. In 2019 alone, the number of displaced Burkinabe shot up from 87,000 to 560,000, according to the U.N. refu­gee agency, with no slowdown in sight.

People are fleeing the restive countryside for the capital city, ­Ouagadougou, hoping that a shelter closer to the presidential palace will offer relative security as the army, backed by French troops, struggles to hold the line in the battle for the future of the country.

Abdoulaye, a fidgety teenager with pop-star curls, is among the uprooted.

They’re a mix of people from his native Mali, who ran to neighboring Burkina Faso after conflict erupted in 2012, and those who opened their backyards to the refugees, only to pack up themselves once terrorists spilled over the border.

“It happens so fast,” Abdoulaye said: Another Monday, another attack, another family sent scrambling through cornfields and along dirt roads. He knows that people like him wait years or decades to leave war zones — if the opportunity ever arrives. He must stand out to have a chance.

More than 1.4 million people worldwide “urgently” needed to be resettled in 2019, the United Nations said, and fewer than 60,000 saw their wish come true. The rest stay in camps, living in tents or other makeshift dwellings. Children go without school. Life blurs into limbo.

Abdoulaye fears an eternity of sitting around. He practices his dancing in the bath, in the street, in the line for fish and rice — “everywhere,” he said, “all the time.”

Dancing as violence nears

He remembers when it struck him — a love at first sight.

Six years ago, a troupe of dancers visited the Mentao camp in northern Burkina Faso, where his family had landed after the war reached their hometown in central Mali.

They taught Abdoulaye, who was 12 at the time, and other kids in the tent city of roughly 12,000 how to lunge, leap and twist to music that gave him butterflies.

It was the first time in months that he hadn’t thought about the three-day escape in the back of a neighbor’s truck, of the bodies on the roadside.

Before long, he became Mentao’s miniature entertainer, belting out tunes in his mother tongue, Tamasheq, while showing off moves in the West African style. An aid worker gave him an acoustic guitar.

He woke up with a sense of purpose: Sing, dance. Sing, dance. Get better, better, better.

Every few months, Abdoulaye could take a six-hour bus ride to the capital and work with instructors at a studio called la Termitière, or the Termite Mound — the brainchild of Burkinabe choreographers Salia Sanou and Seydou Boro.

The classes kept him going. He was thrilled to improve with each session. But he was quietly jealous of the dancers who could pay the fees to practice daily. They brought crowds to their feet, clapping furiously.

Dance was their ticket to the world. How could he move that powerfully? That freely?

Three years passed this way: dreaming away the tranquil days. Then conflict screeched into Burkina Faso in 2016 with a terrorist attack on an upscale hotel and restaurant, killing 30.

Islamist militants began striking markets, churches and schools. They planted bombs on roads. They stole cars and kidnapped boys — recruiting for their mission at gunpoint.

Abdoulaye’s world was crumbling again. Suddenly, the road between his refugee camp and the studio turned perilous.

“If I went, I knew I could die,” he said, “but if I did not go, I’d die in another way.”

So off he slipped to the Termite Mound on public buses, sweating the whole way.

He continued even as gunmen wearing turbans and camouflage began targeting villages closer and closer to Mentao.

Attackers thought to be armed with automatic weapons from disintegrating Libya had been trying for years to establish a caliphate in West Africa

They had trickled across porous borders, despite heavy military intervention from France and the United Nations, and quickly overwhelmed Burkina Faso’s cash-strapped government in the hot, dry terrain.

Abdoulaye’s camp was woefully vulnerable. By late last fall, aid groups could no longer reach it — extremists had stolen SUVs, kidnapped workers and shot up cars on the main road.

The U.S. Embassy evacuated the children of staffers in Burkina Faso and updated its travel advisory: “Terrorists may conduct attacks anywhere with little or no warning.”

Then one day in November, Abdoulaye’s cousin returned to Mentao shaking and covered in blood. He had just escaped an ambush.

The family had to get to Ouagadougou quickly, he said. They bought one-way tickets.

Dreaming of a way out

The Termite Mound is hidden.

“In trash and dust,” joked co-founder Salia Sanou, a prominent choreographer who grew up in western Burkina Faso.

Students reach the studio on motorbike, weaving along bumpy roads, between grilled-mutton stalls and concrete houses in what used to be one of Ouagadougou’s most run-down neighborhoods.

Sanou, 50, built the campus there in 2006 with the help of government funds and French donations. He wanted to clean up the streets and give rudderless youths a productive hobby — even careers. Which is how he connected with Abdoulaye’s camp.

“Dance,” he said, “gives them the confidence to rebuild their lives.”

It’s a sort of cultural exchange program. The refugees from Mali pair with dancers from Burkina Faso. They concoct interpretive routines based on loneliness, love and war.

“Suddenly, in a split second, everything is turned upside down,” reads one show’s description on the studio’s website. “A devastating storm leaves us helpless.”

The dancers perform regularly as the violence inches toward Ouagadougou.

“We all feel it in our stomachs,” Sanou said, “but we refuse to stop living.”

Abdoulaye, wearing a red Nike shirt, wandered behind the choreographer.

“He could do this professionally,” Sanou said, pointing him out.

The teenager glowed at the praise on a recent January afternoon, fist-bumping the friends he has made over the years.

“There’s our star,” one woman shouted.

He had restarted his life, once again, from a cramped apartment on the outskirts of the city. He shares a room with his mother, father and sister. They rely on the kindness of their neighbors as they look for odd jobs.

Abdoulaye, who spends every second he can at the Termite Mound, padded over to the bleachers. As he watched the older students practice, the familiar longing crept back.

If only he could join them on the mat. Full time.

He doesn’t have the money, but he has heard people can get scholarships to train at studios abroad. Some even get talent visas. He doesn’t know how that works.

People from everywhere turn up at the studio.

He could always get noticed by a scout. Or on the Internet. An international nonprofit posted a video of him singing last year on Facebook.

Of course, he dreams of returning to Boni, his old village in Mali, where his family raised cows and goats. He loves Ouagadougou, too, but he’s scared of what could happen next.

He’s tired of running from war.

“It’s your turn to practice,” an instructor shouted.

Abdoulaye bounded to the dance floor. The drums started. He closed his eyes.

He was onstage in Paris or New York.