KABUL -- Nabil Ahmad was at his desk at a logistics support firm last spring when an explosion ripped through the office.
Windows shattered. The ceiling collapsed. "I thought it was an earthquake -- or the end of the world," the Kabul native said.
At 26, Ahmad, who favors Western suits and now works for a cellphone service provider, has never known a time when his country was not at war. But he's a father now, with a 2-year-old and an infant to think about.
"I don't want to put my sons in the position that I was growing up," he said. "I want to get my family out."
Like many Afghans, Ahmad is desperately seeking an exit strategy before most foreign troops leave next year.
A recent study warned of a "contagious pessimism" among Afghan business and political leaders and the urban middle class. "Crucially, there are indications of a self-fulfilling prophecy: Fear of instability in 2014 is driving emigration of the very people and money that could prevent instability," said the report by the development consultant, STATT.
The wealthy are buying second homes abroad and moving huge amounts of money out of Afghanistan from fear that security will deteriorate and the economy will collapse. Others are applying to study overseas, seeking invitations from relatives abroad or risking their lives trying to get into countries illegally.
If he can get his wife and children to safety, Ahmad would like to keep working here. He has been trying to arrange a trip to Europe and figures the family can apply for asylum once they get there. But obtaining visas is almost impossible.
Some travel agents say they can arrange invitation letters from families in far-off countries to support visa applications. Others claim to have embassy contacts who will issue visas under the table. But it's expensive and they don't always deliver.
Decades of conflict and natural disasters have driven waves of Afghans to depart in search of safer, more prosperous lives. In one of the most dramatic refugee crises of the 20th century, millions fled to neighboring Pakistan and Iran during the Soviet occupation in the 1980s and the 1990s civil war that eventually gave rise to the repressive Taliban regime. Those migrating included much of the country's intellectual elite, some of whom resettled in the United States, Europe and elsewhere.
Although record numbers have returned to Afghanistan since U.S.-led forces drove the Islamist militants from power in 2001, the rate has slowed. For the first time in a decade, officials with the International Organization for Migration believe that more Afghans left their country last year than moved back.
Prices for high-end real estate in Kabul have plummeted by as much as 50 percent as members of the business and political elite scramble to move their families and assets out of the country.
"Everything has stopped," said Elyas Faizi of Blue House Real Estate. "No one can sell. No one is buying."
Some of his clients are snapping up apartments and villas in Dubai on the Persian Gulf, where wealthy Afghans have long sought sanctuary. The number of Afghans buying property there jumped in 2011 and 2012, many paying in cash, according to local brokers.
"I think they wanted to have a Plan B in place," said Parvees Gafur, chief executive of Propsquare Real Estate in the United Arab Emirates.
At least $4.6 billion in cash, the equivalent of about a quarter of Afghanistan's annual economic output, was carried out of the country on flights to Dubai and elsewhere in 2011, according to the central bank.
The government believes that some of the money was diverted from foreign assistance or was the product of illicit drug deals. It now limits to $20,000 the amount passengers can carry. But officials have also noted an increase in overseas bank transfers, said central bank Gov. Noorullah Delawari. No one knows how much more is leaving the country without being declared.
In one of Kabul's new shopping malls, Hajrat, who like many Afghans uses only one name, has been running a cosmetics store since high school. Now in his early 20s, he makes enough money to pay for a car and expensive holidays in Dubai.
He would seem to have every reason to stay. But he plans to invest his savings in another country -- one where he doesn't have to "worry about suicide attacks all the time."
"I'm happy until 2014," he said in between counting out a stack of cash for a supplier and offering spritzes of perfume to well-heeled customers. "After that, I don't know where I'm going ... but I'm sure I'm leaving."
As many as 40 percent of Afghan diplomats don't return from overseas postings, according to parliament's Commission on International Affairs. (The Foreign Ministry says the figure is lower.) Students, athletes and others who travel in an official capacity have also failed to return.
The number of Afghan asylum applications to 44 industrialized countries reached more than 36,600 in 2012, according to provisional figures from the United Nations refugee agency, more than at any time since 2001. Many were trying to enter Europe, with Germany and Sweden among the most sought-after destinations. There were just 204 applications to the U.S., which is much farther away and viewed as a more difficult place to obtain asylum.
Enterprising fraudsters sell fake letters purporting to contain threats from the Taliban to bolster asylum requests.
But many Afghans don't qualify for refugee status, said International Organization for Migration spokeswoman Aanchal Khurana. So they look for other ways out, both legal and illegal.
The U.S. Embassy, for example, is working through a backlog of applications for special immigrant visas, which are offered to Afghans whose work for the U.S. government puts them at risk. Others try for visitors' visas and hope they can hide out when they get there.
Mohammad Nasir, a 25-year-old Kabul travel agent, fields frequent inquiries -- 10 or 20 a week -- from would-be migrants.
Most of those seeking Nasir's help are young men hoping for a ticket to a new life in the West.
"2014 is becoming a very big problem in Afghanistan," said Nasir, who would like to get out himself. "Nobody knows what is going to happen. Some say the Taliban will come back, and the young generation is afraid. It was a dark time in Afghanistan."
Nasir said his agency won't do anything illegal, but can help clients obtain visas to India and Pakistan, where they may hire smugglers to get them to Australia, usually via Malaysia and Indonesia. Others, he said, fly to Turkey or Russia and try to sneak into the European Union.
Smugglers' rates vary but start around $15,000 for a trip that may include a perilous hike through the mountains of Iran to Turkey, before crossing by land through Eastern Europe or by sea to Greece or Italy. Scores, if not hundreds, have died in the attempt.
In one of the worst incidents, about 90 prospective asylum-seekers, including numerous Afghans, drowned in June when their overcrowded boat capsized in the Indian Ocean en route from Indonesia to the Australian territory of Christmas Island.
The Ministry of Refugees and Repatriations has distributed brochures and broadcast appeals warning against attempting such "deadly paths."
"Crossing mountains, forests, rivers and deserts is not the right way ... for migration, but only add to the problems of our people," Minister Jamaher Anwari said in one televised appeal.
Ahmad isn't willing to take such risks. A local travel agent offered to get his wife a visa for job training in Italy for $15,000. But she would have been allowed to bring only the baby with her. Ahmad decided to keep looking.
Los Angeles Times special correspondent Hashmat Baktash contributed to this report.