MOGADISHU, Somalia — In the years to come, Ahmed Jama will be seen either as a visionary or a lunatic who squandered his money on a crazy dream.

That crazy dream? To bring tourists to his hotel on the shores of one of the world’s prettiest beaches — which just happens to be on the edge of a city known for more than 20 years as the world’s most dangerous place.

Mogadishu.

In his dream, there won’t be half a dozen guards with guns on the back of an SUV for most foreign visitors, like now.

And the haunting memories of ruthless warlords, crippling famine and terrifying armed children will have faded.

Instead, there’ll be surfing and swimming, seafood pulled fresh from the sea and little shops selling exotic shells and tourist souvenirs. On that, he’s staked $200,000 to build a hotel and restaurant complex at the magnificent Jazeera Beach.

It has all the elements of a tourist brochure: white sand, azure sea, boats bobbing like sea gulls, a mysterious rocky island just offshore, a village on a point with little pink and white houses, all set out as the breakfast view below his quaint open-air restaurant.

Jama wanders through the place gesturing proudly at the tiled floors, fresh paint and colorfully decorated ceilings. It’s not five-star luxury, but at $100 a night, its market isn’t foreign tourists — yet — but the Somali diaspora nostalgic for their homeland the way it used to be.

But even his wife, Amina, isn’t convinced. She visited, with their children, and swiftly made plans to fly back to London, where Jama lived as an emigre during his country’s long nightmare.

Craziest of all, he says he’s doing it not for the money, but to foster hope, after countless failed efforts to rebuild the nation.

“The message is there is a good side to Somalia,” says Jama, 46. “There will be change here. It’s a beautiful country. We need change. That’s my message.”

This capital city teeters on the razor edge dividing war from peace, as if it could yet slip back into the chaos that found as its international symbol the searing image of American soldiers’ bodies being dragged through the streets after their Black Hawk helicopter was shot down nearly two decades ago.

The vacant windows of bullet-pocked ruins give the city a haunted, mournful air, and a new government is yet to form. But the streets are crowded, the roads are choked with cars, and the shops are daubed with gaudy, freshly painted murals.

Women in bougainvillea colors float through the little street markets, shopping for food. Old men prod their walking sticks into ankle-deep puddles left by recent rains. Outside a shop, an artist applies his brush carefully to a wall, poised to add yet another splash of garish color.

After more than 20 years of violence, people almost dare not hope that — this time — peace will actually stick. But the revival of the city is so infectious, they can’t help it.

A year ago, the Shabab, a radical Al Qaeda-linked militia that had ushered in a new reign of terror, abandoned Mogadishu, and has since lost more territory. But the sporadic suicide bombings, daily sputtering of gunfire and sinister targeted assassinations are enough to raise fears that the Shabab can still strike fatally at the city, or that the Somali warlords and businessmen who profited so much from decades of war have not had their fill.

In coming days or weeks, the parliament that was just selected will elect a president. He will appoint a prime minister, who in turn will choose a Cabinet, in a process designed to balance the power of Somalia’s clans. If it goes wrong, no one here is in any doubt that the country will slump once more into violence and warlordism.

But the relative peace has seen a revival of business unlike anything since 1991, when the fall of dictator Mohamed Siad Barre led to 21 lost years. In the fish market, buyers and sellers throng around neatly arrayed rows of the glistening catch. New buildings are going up and Mogadishans frequently boast that instead of AK-47s, the city rings with the sound of hammers.

Emigres are flooding back with money, ideas and confidence, brushing off concern about whether the peace will fracture. Turkish Airlines now runs a direct flight from Istanbul to Mogadishu, and it’s hard to get a seat on the inbound flight.

A year ago, it would have been unthinkable to open what is claimed to be the country’s first commercial bank. Or build a hotel on a white sand beach.

A skinny figure in a baggy T-shirt and too-big trousers, Jama shambles down the beach below his almost-finished hotel to greet some visitors. He drops the final consonants of words as if scattering coins to beggars, in the twang he picked up living in Britain’s east Birmingham and West London for nearly 25 years.

As a student, training as a chef in the British Midlands, he was hurt by the way people talked about his country — as if there was a fatal, inevitable Somali “character,” condemned to violent self-annihilation.

“ ‘Is that your people?’ That always used to cut you. When people ask you in the middle of college, ‘Is that your people?’ That makes you feel bad.”

As a boy in Somalia, the son of a poor sheep and cattle trader, Jama had a dream that was simple but rather vague: He wanted to be a big success. Now he has a restaurant in London, a restaurant in Mogadishu proper and the beachside resort near a lagoon full of flamingos.

When he decided to go to Mogadishu to start a business, just a month after the Shabab militants left the city, friends in the Somali diaspora were stunned.

“Everyone was saying: ‘Please, do not go there. Stay over here.’ Some of them believe that in a couple of days, I’ll come back.”

Many doubts remain, but the return of the diaspora, the swift investment of money and booming property development, and even plans to launch a stock exchange, make this period of peace different from past efforts at stability. There is now a new group with a big economic stake in peace — and an emotional one too.

In a quiet corner of Mogadishu, a small cemetery, empty but for a few ambling goats, is a starting place for Safia Yasin’s quest for the grave of her father.

Yasin, 34, wearing a long, flowing black garment and pink polka-dot scarf, treads slowly up a sandy incline, ignoring the garbage at her feet

“It’s well taken care of. That’s something,” she murmurs to herself. When she was only 2, she remembers sitting barefoot and crying on the front steps of the hospital where he lay dying.

In the graveyard, she meets a mullah with one finger blown off, who tells her that all the graves are listed and while it might take time, her father’s will certainly be found.

Yasin resigned from her job managing a healthcare company in Minnesota and returned to her birthplace last month to placate the ghost memories of her childhood and find her father’s resting place.

“Identity is very important. I lived in the States for 20 years, but still there was a gap,” she says.

There’s another reason she came: to be of use.

Yasin, who has a master’s degree in government policy, works at a nongovernmental organization, the Center for Research and Dialogue, helping Mogadishu youths scarred by war, and girls still traumatized from when teenagers were forcibly married to young Shabab fighters.

“Those of us in the diaspora have to come back and change this country to the way it was before,” she says. “All my memories, all my history, is here. These crumbling buildings, this is who we are. That’s why I feel I’m home.”

Among returnees, there’s an almost euphoric desire to convert others, a sense that if only enough money and hope flood back, everything will be OK.

In the conference rooms of Mogadishu’s first commercial bank, participants in a recent event enthused that the city was ready for investors. (The conference was held in May under the auspices of TED, the New-York based nonprofit that fosters inspirational talks by people with “ideas worth spreading.”)

The bank’s owner and co-organizer of the event, Liban Egal, a Somali American from Baltimore, acknowledges that the war-torn country doesn’t yet have the laws and courts to allow his bank to expand and lend money. In fact, it’s losing $20,000 a month, losses he says he can sustain for perhaps six months.

The bank’s biggest overhead cost is security, in a city where anyone important never goes anywhere without a couple of dozen security guards. At the moment, Egal, 43, is pitching to small and medium-size businesses, hoping to handle their payrolls and other accounting matters.

And for businesspeople, there is an upside here: There are no taxes or state interference.

As Egal talks, gunfire explodes a couple of streets away and rattles on for 10 minutes. He ignores it, as though it was a neighbor’s annoying barking dog.

Egal set up his first business, a fried-chicken joint, in a part of Baltimore he says was so bad that he had no competition. He realized that he actually enjoyed risk.

He’s gone from small risks, like losing $5,000 or $6,000 a month in his Baltimore small financing company, to huge ones, like opening the bank in Mogadishu. He also started an Internet server and a research company.

“When I came in August [2011], when Shabab had just left and the city was empty, I decided to do this project, the Internet and the bank. People thought I was crazy, because at the time Shabab was very powerful. But I could see at the time that the tide was turning.

“I’m a risk-taker. I’ve noticed some people have no tolerance for even losing $10. They cry like someone died. I didn’t have a problem. That’s why I took the risk of coming here so early.”

Egal has little confidence that the political path will be smooth, but says as long as the African Union peacekeeping forces in Mogadishu maintain security and the new government brings in a legal framework, businesses will flourish and governance will slowly improve.

Jama, his fellow entrepreneur, is still working to convince his wife the place is safe. But he’s sure that he’ll eventually win her over.

“I feel like it’s going to be better and I feel like it’s going to be soon,” he said. “Miami Beach wasn’t built in a day.

“You can come back next year, without guards.”

robyn.dixon@latimes.com