PUERTO RICO has put on a brave face during its year-long debt crisis. But on June 28th Alejandro García Padilla, the governor, made a belated concession to reality by signing a law establishing a de facto bankruptcy regime for state-owned enterprises. With the Puerto Rico Electric Power Authority (PREPA), a cash-strapped utility, teetering on the brink of default, the new system may face its first test soon.

Puerto Rico’s woes stem from a mix of structural weaknesses, external shocks and self-inflicted wounds. As an overseas American territory, it uses the dollar and the national minimum wage. That makes labour costly and exports uncompetitive. From 1976-2006 firms on the island were exempt from federal tax on their local profits. But once that carve-out expired, the economy fell into an eight-year recession. And after Detroit went bankrupt, investors fled risky municipal bonds, which raised Puerto Rico’s financing costs.

However, the government also bears its own share of the blame. It has spent too little on infrastructure and too much on pensions. And it has grossly mismanaged PREPA, which still generates 65% of its power using expensive fuel oil. Not only did the company cost the state $276m in 2013 but its high prices serve as a tax on most economic activity. Mr García Padilla has tried to compensate with austerity: on July 1st he signed a balanced budget that cut discretionary spending by 8%. But Puerto Rico’s public finances have regularly underperformed official forecasts.

The government insists that it “cannot default”, because its constitution gives debt payments first priority. However, this only applies to its general-obligation and guaranteed bonds. The remaining public debt is backed by specific revenues like highway tolls or, in PREPA’s case, electric bills. And the $800m of bank credit lines PREPA uses to buy fuel come due in August. Unless it can renegotiate quickly, it will either default or turn out the lights.

No one knows what would happen then. Puerto Rican state agencies fall in a gap in America’s bankruptcy code: they are excluded from the regimes both for local governments and private firms. As a result, missed payments would probably set off a whirlwind of litigation. To forestall this risk, the government instituted a new insolvency system for its companies. It gives them nine months to negotiate a settlement acceptable to holders of 75% of their debt. If the parties cannot agree, local courts would impose a solution. Investors saw the law as evidence that PREPA was set to restructure its $8.6 billion of liabilities, and have dumped its bonds.

But PREPA’s two biggest creditors, the mutual-fund firms Franklin Templeton and OppenheimerFunds, have challenged the law, arguing that the constitution gives Congress exclusive control over bankruptcy. If they win, it might boost calls to change Puerto Rico’s status. As the 51st state, its state-owned firms would be covered by the federal bankruptcy code. As an independent country, it could set its own rules. Under the status quo it may be stuck with neither.