One recent morning at the start of the Kenyan rainy season, I boarded a shuttle bus at Nairobi’s Jomo Kenyatta International Airport. At a distant corner of the tarmac, we stopped before an aging Boeing 737. The logo of Jubba Airways, the unofficial national carrier of Somalia, was painted on the fuselage: three horizontal stripes, each a different shade of blue, and the slogan: THE HAPPY WAY TO FLY.

In its early days, 15 years ago, the Jubba Airways fleet consisted
entirely of battered relics from the former Soviet Union: Ilyushin-18
twin-engine turboprops. “They were not the best quality, but nobody
other than Ilyushin operators were willing to go to Somalia at that
time,” said Abdullahi Warsame, Jubba’s managing director, who was
accompanying me on this flight to Mogadishu.

Since then, those planes
have been replaced by four Boeing 737s, all but one manufactured before
1988, and three Antonov AN-24s, Soviet-era, 44-seat propeller planes
whose engines are mounted high on the wings to avoid the stones and
other debris that can ricochet off poorly maintained runways. Because
Jubba has little capital to invest, it leases all the planes in its
fleet. A used Boeing 737 from the 1980s sells for $3 million; by
contrast, it costs Jubba about $400,000 a month to lease a Boeing 737,
and $80,000 to lease an Antonov. Jubba uses its four Boeings (leased
from a Danish operator) on its international routes; it flies the
Antonovs (leased from a Armenian company) domestically. “They are very
tough planes,” Warsame said. “And you know, the airports in Somalia are
kind of rough, and those aircraft from Russia can endure.”

A 40-something Somali who immigrated to Canada 25 years ago, Warsame now
lives in Dubai, in the United Arab Emirates, where Jubba has offices.
But he travels back to Mogadishu every month or two. The Al
Qaeda-affiliated terrorist group Al Shabaab, which once controlled much
of Somalia’s territory, has been in retreat, and Jubba is expanding its
domestic routes.

Female flight attendants, from Kenya, served orange juice before
takeoff. Because Jubba is registered in Kenya, the airline is obliged by
law to hire, with a few exceptions, Kenyan citizens for maintenance
staff and its in-flight crews on international flights. As the plane
taxied down the runway, an Islamic prayer for travelers played over the
intercom system.

Across the aisle from us sat two Somali émigrés, Hussein Abdullahi, 43,
the branch manager of a Midwestern bank, and his friend, Jibril Mohamed,
a Dubai-based entrepreneur. Abdullahi was making his first trip back to
Mogadishu since he fled in 1988. Peering nervously out the window as we
ascended over Nairobi, he explained that his friend Mohamed had
recently founded a commercial bank in newly independent South Sudan.
“Jibril said we should try the same thing in Mogadishu,” Abdullahi said,
as his friend, a man with a husky physique, nodded. “I told him, ‘You
want me to go to Mogadishu? You’re crazy.’ He said, ‘Come with me,
you’ll see it and then make a decision.’ ”

Abdullahi considered the proposal for a weekend. “And I said to myself,
if I don’t sacrifice and go home, then who’s going to do it?” Abdullahi
told me that Jubba Airways’ founders had served as an inspiration for
him. “These guys have courage,” he said. “They never gave up on this
place.”

Two hours later, we touched down in Mogadishu without incident on the
airport’s single runway. Until late 2011, Al Shabaab controlled 9 of 16
districts in Mogadishu, some within firing range of Aden Abdulle
International Airport. Pilots were instructed to ascend and descend
rapidly over the ocean, and to avoid flying at low altitudes over the
warrens of the city. The rebels have since been mostly driven out, but
pilots still perform the same maneuver.

Last year, the Washington-based nonprofit organization
Fund for Peace ranked Somalia No. 1 on its Failed States Index for the
fifth consecutive year, ahead of Congo, Sudan and Zimbabwe. The group
cited “widespread lawlessness, ineffective government, terrorism,
insurgency, crime and well-publicized pirate attacks against foreign
vessels.” More than two decades of civil war and anarchy have left the
country of 10 million with little functioning infrastructure. Somalia
has only a handful of passable roads — and most of those are patrolled
by bandits and militias. The country lacks water purification, sewers
and electricity. Last fall, when a Norwegian aid organization switched
on a four-mile stretch of solar-powered lamps along Mecca Mukarama
Street, Mogadishu’s main commercial avenue, it was the first time in a
generation that the Somali capital had streetlights after dark.

But Somalia does have airlines. In 1991, when its government dissolved,
Somali Airlines, the state-owned carrier, collapsed with it. The country
fell into a civil war between clans that dragged in both United Nations
peacekeepers and U.S. forces. Eighteen American troops died in the
infamous “Black Hawk Down” battle in October 1993. The U.S. and U.N.
forces soon pulled out, and Somali warlords battled for control, then
eventually gave way to Al Shabaab militants.

During those anarchic 20 years, at least 15 private commercial carriers,
many of them Somali-owned, have tried to take over pieces of the
defunct airline’s market. They range from short-lived ventures like
Gallad Air, which flew for two years before shutting down in 2005, to
African Express Airways, which has operated in the region for more than
two decades.

“Road insecurity is bad for Somalia, but it’s good for airlines,” says
Abirahman Aden Ibrahim, a former deputy prime minister. Ibrahim
estimated that at least 60 planes owned or leased by Somali carriers are
currently flying.

Jubba Airways may be the most ambitious, and fastest-growing, of those
carriers. Since its beginnings in 1998, Jubba has served as a lifeline
for Somali businessmen with interests abroad, pilgrims on the hajj
in Saudi Arabia and — increasingly — returning members of the Somali
diaspora. The airline flies to some of the world’s most unstable
destinations, including Galkayo, a town that straddles the self-declared
independent republics of Puntland and Galmudug, both notorious
sanctuaries for pirates. “Jubba passed through a tough period, but they
can now be seen as our national airline,” said Ali Mohamoud Ibrahim,
general manager of the Somali Civil Aviation and Meteorology Authority,
whose duties were taken over by the International Civil Aviation
Organization after the government collapsed in the early 1990s. “Without
their activities in Somalia, the connection with the world would have
been very bad.”

Jubba’s quality is hit or miss. In a blog post, one passenger described
one of Jubba’s Antonovs as a piece of “Soviet dereliction” in which a
family of five sat piled into three seats. “We had to board an old
Russian plane. In total darkness,” an online reviewer wrote of his
“flight from hell” to Hargeisa, the capital of the self-declared
republic of Somaliland. “The seats had no seat belts, there are luggage
and 20 boxes on back seats, not secured. . . . Avoid by all costs.”

Warsame insists that all his planes have seat belts now. “I’m thinking
this must have been written by one of our Somali competitors,” he said.

In April 2012, a Jubba pilot pulled up his Antonov AN-24 at the last
second to avoid crashing into a goat that had strayed across the runway
in Galkayo. The Antonov flipped on its side and lost a wing. Remarkably,
nobody was killed. Warsame blames the near-tragedy on the lack of
fencing around Galkayo airport, but the pilot, he says, is not flying
for Jubba anymore.

Jubba also has to contend with the draconian security measures imposed
on its international flights. Fearful of infiltrations by Al Shabaab
militants — who have carried out grenade attacks in Nairobi and Mombasa —
the Kenyan Civil Aviation Authority requires that all planes bound for
Nairobi from Mogadishu land first in Wajir, a desert outpost just across
the Somali border. Security teams unload and scan all the baggage and
submit passengers to searches and rigorous immigration procedures. When
flights are full, the process can take hours.

Responding to a dearth of reliable air transport to and
from Somalia, five businessmen founded Jubba Airways in 1998. The
company took its name from a river that flows through southern Somalia.
The five raised $800,000 from a dozen Somali investors, rented an office
in Sharjah, the emirate just northeast of Dubai, hired a staff and
chartered a pair of Ilyushin-18 turboprops. Sharjah had become a haven
for aircraft companies from Kazahkistan, Tajikistan, Georgia and other
states of the former Soviet Union. These operators took advantage of
Sharjah’s absence of regulations to lease old Soviet planes to small and
struggling airlines, most of which were based in war zones and former
war zones.

On May 28, 1998, Jubba Airways made its inaugural flight from Sharjah to
Mogadishu. At the time Mogadishu’s airport was closed and Jubba was
forced to land on an airstrip a dozen miles from the capital. The
company soon inaugurated a three-times-weekly service between Sharjah
and Mogadishu. Later passengers flew into Baledogle, a former military
base 60 miles from Mogadishu, then were bused past a series of
checkpoints controlled by feuding militias.

Sharjah tightened its regulations after 9/11, expelling Eastern European
charter companies and putting an end to Jubba’s flights to Mogadishu.
Warsame joined the company in 2003, and he made two critical decisions.
First, he began signing long-term leases for dedicated aircraft rather
than chartering planes on a flight-by-flight basis. This allowed Jubba
to develop a reliable flight schedule. He also registered Jubba in
Kenya, a difficult two-year licensing process that gave the airline
international legitimacy. (Before, Jubba had been registered in Somalia.
But Somalia’s Civil Aviation Authority collapsed in 1991, and aircraft
registered there can’t officially land anywhere else in the world.)
Somalia was then, in 2006, enjoying a brief period of stability under
the Islamic Courts Union, a militant group financed by Somali
businessmen. Mogadishu’s airport reopened for the first time in several
years, and Jubba began to grow. Warsame says the gunmen have mostly left
Jubba alone. “They knew we are not involved in politics, we are working
for the people,” he told me. “We have stayed neutral.”

Some of Jubba’s pilots are close to the ends of their careers. “I was
near retirement, and I didn’t want to end up in Baghdad,” says Zaccheus
Akighi, 63, a former Nigeria Airways pilot who flew in Afghanistan and
Iraq for Eastok Avia before taking a Nairobi-based job for Jubba last
year. Younger pilots like Jubba’s fast career track. Robert Sifuna, a
32-year-old Kenyan, jumped from Kenya Airways to Jubba last year
because, he says, “it would have taken me five years to become a captain
at Kenya Airways.” (War-same’s explanation: “Kenya Airways has been
around for a long time. If you’re a co-pilot, you can only become a
pilot when the old ones retire.”) Jubba also has a team of Ukrainian and
other Russian-speaking pilots who fly its Antonovs on domestic runs
inside Somalia. Although the capital has been relatively calm for the
past year and a half, Jubba still offers incentives and imposes rules on
its pilots. “Whenever we fly to Mogadishu, we give them combat pay,”
Warsame said. “And they never stay. They land and leave as fast as they
can.” Jubba pays the captain, co-pilot and flight attendants “around
$100 extra” for each landing they make in Mogadishu; the bonus goes up
after they make the trip several dozen times.

Raising funds to expand the airline has been a challenge. “When banks
see that you are operating in Somalia, they become afraid,” Warsame
said. “It is impossible to get a loan.” Instead, Jubba has depended on
periodic cash infusions from the company’s original investors. During
the high summer season, when Somali expatriates pour into the country,
the airline charges between $150 and $165 for its domestic flights, $196
for its Mogadishu-Nairobi run and $340 for its flights between
Mogadishu and Jeddah, Saudi Arabia; fares drop during the low season.
The airline has to fill 70 percent of its seats to break even. “We have
lost money some years,” Warsame admits, but the company has turned the
business around through aggressive marketing, close relationships with
European, Somali and U.A.E. travel agencies and an upsurge of business
from Somali expatriates. Jubba’s planes are now 85 percent full, and the
company is making a modest profit.

Although the airline business is traditionally tough, and Somalia
remains volatile, Jubba’s investors perceived early on that the
potential rewards outweighed the risks. “At the beginning, so few
airlines were willing to operate, it gave us practically a monopoly,”
Warsame said. Several more players are in the business now, but Jubba’s
infrastructure, reputation and strong network of travel agents give the
company a clear advantage should the situation settle down. “We are well
positioned to make a lot of money,” Warsame said.

Others, too, have also begun to see Somalia as an enticing investment
opportunity. Dozens of companies attended a May 2013 investment
conference in Nairobi, lured by the possibility of a decisive defeat of
Al Shabaab and the strengthening of the central government. Several
European, American and Middle Eastern companies have explored making
major investments in Mogadishu’s port. “We welcome them, but we say we
are still building the legal framework [for foreign investors],”
President Hassan Sheikh Mohamud, who survived an assassination attempt
last fall, told me. “It is still too early.”

On my last morning in Mogadishu, I ran into Hussein
Abdullahi, the bank manager from my Jubba flight, in the courtyard of
the Jazeera Hotel. Wearing a black business suit in the wilting heat, he
seemed upbeat, ready to invest in Somalia’s future. “I’ll be back again
before too long,” he told me.

It appeared that he would have more options to choose from than Jubba
Airways. The country’s long-isolated airline industry is slowly
integrating with the rest of the world. It is working with the
International Civil Aviation Organization, and more carriers have begun
flying to Aden Abdulle Airport. Turkish Airlines inaugurated three
flights a week between Mogadishu and Istanbul, via Djibouti. Warsame
said Emirates Airline and Egypt Air have expressed interest in resuming
flights. Ali Mohamoud Ibrahim, the civil aviation chief, told me that
the government was even talking about restarting Somali Airlines.
“Competition is good for everybody,” Warsame insisted, as we waited for
our Jubba flight back to Nairobi in a spartan V.I.P. lounge.

Jubba itself is in the midst of a new expansion. Warsame visited Addis
Ababa and Kampala recently, keen on initiating direct flights between
those East African capitals and Mogadishu. He has also “started
inquiries” about purchasing Jubba’s first plane, and has his eyes on
either a Boeing 737-800, one of the newer versions of the 737 aircraft,
or an Airbus A320. Domestically, Jubba has inaugurated Antonov flights
to Baidoa, a central Somalian town known as “the City of Death” during
the devastating famine of the early 1990s; and Kismayu, a strategic
southern port held by Al Shabaab until last November, when Kenyan AMISOM
troops drove out the militiamen. Kismayu is still unstable, with two
clans feuding violently for control of the port’s lucrative charcoal
trade. But Warsame said that the demand for access to the city was so
high that Jubba decided to take the risk. “It is impossible for people
to travel there by road, because of explosive devices and ambushes,” he
told me. “So many people said, ‘We need a flight to Kismayu.’ We sent in
some staff, they inspected the runway, they talked to the local people
and they said it was O.K.”

Still, there are periodic reminders that Al Shabaab fighters lurk in
Mogadishu, capable of shattering this facade of normality. Hours after
Warsame and I landed in Nairobi, a car bomb detonated on a busy street
in Mogadishu, killing 10 people. And one month after that, in a
coordinated attack, six Al Shabaab militants wearing bomb-packed vests
blew themselves up inside Mogadishu’s courts complex. Minutes later, a
car bomb went off on the airport road just yards from the Jazeera Hotel,
killing several African Union and Somali troops. More than 20 people
died in the two attacks, the worst in a year and a half. I reached
Warsame at his office in Dubai and asked him whether he was discouraged
by the rising violence. “It is a setback, it hurts for the moment,” he
told me. “But something like this has to be expected. Those people are
still out there. I still think the future is bright.”

Joshua Hammer, a former Newsweek bureau chief in Africa and the Middle East, is now a freelance foreign correspondent based in Berlin