A deadly collapse at the Rana Plaza factory just outside Dhaka, Bangladesh, killed almost 1,200 garment workers in a single morning in April 2013. The tragedy shone a bright light on the country’s widespread labor-rights enforcement failures.

Now, more than two years later, millions of workers continue to work in unsafe factories. Pressure to improve conditions in Bangladesh’s garment sector has largely come from outside the country—from consumers, international clothing brands, foreign governments, and development organizations. Yet finally a confluence of factors may force Bangladesh’s domestic factory owners to change.

Rise of low-cost competitors

Bangladesh lives off of its apparel manufacturing. As the world’s second largest garment producer after China, the industry comprises 18% of the nation’s GDP and 80% of its exports. But in the last year, Myanmar and Ethiopia have entered the low-wage garment market, and Vietnam will benefit from lower production costs under the newly-agreed-upon Trans-Pacific Partnership (TPP). These nations could easily chip away at Bangladesh’s market share, threatening its dominant position.

Deteriorating security, driven by Islamic extremism

In the last six months, violent attacks by homegrown extremist groups and the Islamic State killed four atheist bloggers and two foreign aid workers in Bangladesh. After Cesare Tavella, an Italian aid worker, was shot and killed in downtown Dhaka while out for a jog in September, foreign buyers have started to pull their expat staff and are requiring factory owners to provide armed security guards for buying visits. The precautions add costs for suppliers while threats reinforce an image of Bangladesh as an undesirable and unstable place to do business.

With increasing demand for “eco-” and “slow” fashion, Bangladesh is perceived as an unsustainable sourcing destination

Adding to Bangladesh’s history of anti-union activity, since the 1990s the American Federation of Labor and Congress of Industrial Organizations (AFL-CIO) has lodged four separate complaints with the US government about failures to adhere to labor rights standards. Despite millions of dollars of investment after Rana Plaza, the perception remains that workers still face serious threats to their safety and dignity at work, deterring ethically-minded companies from manufacturing there.

This combination of domestic instability and external competition threatens the Bangladeshi garment industry and its broader economy unless factory owners push for meaningful reforms.

Making Bangladesh’s garment sector safe and sustainable for the long term will require significant effort in three areas:

An honest accounting of how many factories are producing for the export market. As it stands, no one is sure how many factories are manufacturing for export. The government says it has inspected “more than 80%” of 1,475 export-oriented factories. The Center for Business and Human Rights at NYU Stern estimates that the total number is closer to 7,000. Solutions to making factories safer must be based on a credible understanding of the problem’s scope.

An assessment of the true costs of upgrading, relocating, and overseeing an expanded number of factories, many of which are small enterprises. Remediation efforts to date have focused on large factories that tend to have direct relationships with foreign brands. But small factories are an essential part of the industry, and there are a lot of them. A group including international experts and local owners should assess the costs of the resources, support, and oversight that would be required to make these factories safe places to work for the approximately three million workers employed in them.

Dividing responsibility for these costs among foreign brands, leading local factories, governments, and development and aid organizations. No single actor can underwrite the significant costs of upgrading Bangladesh’s garment sector. Local and international participants should share the costs. Detroit provides a useful model, in which the public-private Blight Removal Taskforce successfully surveyed the city’s problem, developed a blueprint for addressing it, and raised public and private funds to meet the $800 million price tag of clearing blighted structures.

Bangladesh has the potential to be a good-news story about the possibility of globalization delivering benefits to low-wage workers, even in states with weak governance. Yet changes in the way the apparel supply chain works will have to come from within.