If the best time to buy, as the old business adage says, is when there is blood on the streets, then Pakistan's commercial capital, Karachi, offers the ideal investment opportunity.
For more than a decade, the sprawling seaport megalopolis of about 20 million people has been racked by political, militant and criminal violence that has taken thousands of lives. Yet, over the same period, the city stock market, which is also Pakistan's main exchange, has posted spectacular results.
Over the past 12 months alone, the Karachi Stock Exchange has surged more than 44 percent, placing it among the world's top-performing stock markets in dollar terms this year, according to Bloomberg.
That follows a decade of growth in which one dollar invested in an index fund of Pakistani stocks 10 years ago would have earned, on average, 26 percent every year, analysts say, in a period otherwise notable mostly for bad news. As the stock market rose, the Pakistani military leader Gen. Pervez Musharraf fell, Osama bin Laden was captured and Taliban violence spread from the northwest to cities across the country, including Karachi.
Just as surprising, perhaps, Wall Street firms are driving the latest phase of the stock boom. Bad news can make for a good bargain, they say.
"What you see in the popular press is just one part of the picture," said Mark Mobius, a fund manager at Franklin Templeton Investments, which has more than $1 billion invested in Pakistan stocks, mostly in the energy sector. "There's another side to these countries, where life goes on. And that's what we focus on."
(Read more: A perverse Bin Laden incentive for Pakistan)
The gloomy image of Pakistan obscures positive aspects of its economy that, investors say, make some companies an attractive bet. Beyond the headline news, much of the country is getting on with normal life. And with a population estimated at nearly 200 million people — a high proportion of them young — Pakistan offers a large, lucrative market for consumer goods, construction and financial services firms, which constitute the bulk of the Karachi stock market.
The biggest publicly listed companies — like the multinational Nestlé, the Oil and Gas Development Company and Fauji Fertilizer, a military-run conglomerate — pay handsome dividends, which makes them attractive to foreign investors.
And the recent election victory of Prime Minister Nawaz Sharif, a business tycoon, has injected confidence into the financial community, which had been wary of the previous government.
For a time, Pakistani stocks were undervalued by as much as 50 percent to account for risk, compared with a regional discount of about 20 percent, said Taha Javed, a financial analyst in Karachi. Now, as foreign investors pile in, he said, "we are catching up."
Still, there is much to overlook. With painful power shortages, a sliding national currency and dwindling foreign reserves, Pakistan's economy has been on life support in recent years. In August, the International Monetary Fund approved a $6.6 billion emergency loan, on top of $5 billion that Pakistan already owes the fund.
Business safety is a problem. Paramilitary security forces combed Karachi last week as part of a fresh effort to combat criminal gangs that have terrorized the city. Kidnapping for ransom is common. In a "livability" survey of 140 world cities, published by the Economist Intelligence Unit in August, Karachi shared the fourth-to-last rank with the Algerian capital, Algiers. And that is only part of Pakistan's broader security problem, with militant groups and frequent violence against religious and ethnic minorities.
(Read more: Iran nuclear talks: the oil price fallout)
And for all its impressive growth, the stock market can be worryingly unstable, as a sudden dive of about 5 percent last week demonstrated. That slump has now stabilized — it was more of a correction than a crash, it seems — but the market has a history of volatility.
The Karachi exchange closed for four months in late 2008 after an abrupt drop in prices; more recently, it has faced allegations by the news media of insider trading and cronyism. A former chairman of the Securities and Exchange Commission of Pakistan, which regulates the market, is being prosecuted for corruption and tax evasion.
More from the New York Times:
The juxtaposition of a booming stock market with bombs and economic austerity suggests sides to Pakistan, both positive and negative, that are little appreciated outside the country. It shows resilience and business acumen, certainly, but also worrisome fragmentation in a society where rich and poor live ever further apart.
In Karachi, where most big companies and banks have their headquarters, about 2,500 people died violently last year. But the bloodshed is concentrated in the city's working-class areas, allowing the wealthy to continue with life as normal — with some adjustments like layers of security barriers and heavily armed private security forces.
"As far as the killings go, forget about it — that's part of life," said Zain Hussain, chief executive of the stock brokerage firm Taurus Securities. "It's something that I am immune to, and so are most investors."
(Read more: China has much at risk but no reach in Middle East)
Despite some recent overhauls, experts say the exchange is also still perilously underregulated. The current boom was bolstered last year by a law that allowed investors to put money into stocks without having to explain its origin — effectively facilitating money laundering, critics said.
"The penalties are minimal here," said Javed Hassan, chief executive of the Institute of Capital Markets, a body that licenses participants in the Karachi exchange. "Nobody has gone to jail for manipulating the market."
While the Karachi market's success is impressive, it has been built on the money of a small number of foreign investors like Mr. Mobius. If they were to withdraw precipitously, for whatever reasons, prices would most likely tumble again.
"Despite all the positives," said Muddassar Malik, chief executive of BMA Funds, an investment firm, "it's not a country for the fainthearted."