Bangladesh has become one of Asia’s most remarkable and unexpected success stories in recent years. Once one of the poorest regions of Pakistan, Bangladesh remained an economic basket case—wracked by poverty and famine—for many years after independence in 1971. In fact, by 2006, conditions seemed so hopeless that when Bangladesh registered faster growth than Pakistan, it was dismissed as a fluke.

Yet that year would turn out to be an inflection point. Since then, Bangladesh’s annual GDP growth has exceeded Pakistan’s by roughly 2.5 percentage points per year. And this year, its growth rate is likely to surpass India’s (though this primarily reflects India’s economic slowdown, which should be reversed barring gross policy mismanagement).

Moreover, at 1.1 percent per year, Bangladesh’s population growth is well below Pakistan’s 2 percent rate, which means that its per capita income is growing faster than Pakistan’s by approximately 3.3 percentage points per year. By extrapolation, Bangladesh will overtake Pakistan in terms of per capita GDP in 2020, even with a correction for purchasing power parity.

To what does Bangladesh owe its quiet transformation? As with all large-scale historical phenomena, there can be no certain answers, only clues. Still, in my view, Bangladesh’s economic transformation was driven in large part by social changes, starting with the empowerment of women.

Thanks to efforts by the nongovernmental organizations Grameen Bank and BRAC, along with more recent work by the government, Bangladesh has made significant strides toward educating girls and giving women a greater voice, both in the household and the public sphere. These efforts have translated into improvements in children’s health and education, such that Bangladeshis’ average life expectancy is now 72 years, compared to 68 years for Indians and 66 years for Pakistanis.

The Bangladesh government also deserves credit for supporting grassroots initiatives in economic inclusion, the positive effects of which are visible in recently released data from the World Bank. Among Bangladeshi adults with bank accounts, 34.1 percent made digital transactions in 2017, compared to an average rate of 27.8 percent for South Asia. Moreover, only 10.4 percent of Bangladeshi bank accounts are “dormant” (meaning there were no deposits or withdrawals in the previous year), compared to 48 percent of Indian bank accounts.

Another partial explanation for Bangladesh’s progress is the success of its garment manufacturing industry. That success is itself driven by a number of factors. One notable point is that the main garment firms in Bangladesh are large—especially compared to those in India, owing largely to different labor laws.

All labor markets need regulation. But, in India, the 1947 Industrial Disputes Act imposes heavy restrictions on firms’ ability to contract workers and expand their labor force, ultimately doing more harm than good. The law was enacted a few months before the August 1947 independence of India and Pakistan from British imperial rule, meaning that both new countries inherited it. But Pakistan’s military regime, impatient with trade unions from the region that would become Bangladesh, repealed it in 1958.

Thus, having been born without the law, Bangladesh offered a better environment for manufacturing firms to achieve economies of scale and create a large number of jobs. And though Bangladesh still needs much stronger regulation to protect workers from occupational hazards, the absence of a law that explicitly curtails labor-market flexibility has been a boon for job creation and manufacturing success.

The question is whether Bangladesh’s strong economic performance can be sustained. As matters stand, the country’s prospects are excellent, but there are risks that policymakers will need to take into account.

For starters, when a country’s economy takes off, corruption, cronyism, and inequality tend to increase, and can even stall the growth process if left unchecked. Bangladesh is no exception.

But there is an even deeper threat posed by orthodox groups and religious fundamentalists who oppose Bangladesh’s early investments in progressive social reforms. A reversal of those investments would cause a severe and prolonged economic setback. This is not merely a passing concern: vibrant economies have been derailed by zealotry many times throughout history.

For example, a thousand years ago, the Arab caliphates ruled over regions of great economic dynamism, and cities like Damascus and Baghdad were global hubs of culture, research, and innovation. That golden era ended when religious fundamentalism took root and began to spread. Since then, a nostalgic pride in the past has substituted for bold new pursuits in the present.

Pakistan’s history tells a similar tale. In its early years, Pakistan’s economy performed moderately well, with per capita income well above India’s. And it was no coincidence that during this time, cities like Lahore were multicultural centers of art and literature. But then came military rule, restrictions on individual freedom, and Islamic fundamentalist groups erecting walls against openness. By 2005, India surpassed Pakistan in terms of per capita income, and it has since gained a substantial lead.

But this is not about any particular religion. India is a vibrant, secular democracy that was growing at a remarkable annual rate of over 8% until a few years ago. Today, Hindu fundamentalist groups that discriminate against minorities and women, and that are working to thwart scientific research and higher education, are threatening its gains. Likewise, Portugal’s heyday of global power in the fifteenth and sixteenth centuries passed quickly when Christian fanaticism became the empire’s driving political force.

As these examples demonstrate, Bangladesh needs to be vigilant about the risks posed by fundamentalism. Given Prime Minister Sheikh Hasina’s deep commitment to addressing these risks, there is reason to hope for success. In that case, Bangladesh will be on a path that would have been unimaginable just two decades ago: toward becoming an Asian success story.