The world would be a much better place if Argentina were more like Detroit. Messed up as the Motor City’s finances may be, at least the city is covered by U.S. bankruptcy law, under which the municipal government and its creditors are working out a binding settlement under the supervision of a federal judge. One way or another, Detroit’s debt nightmare will end, and the city will get a fresh start.

No bankruptcy system applies to nations, though. “The entire sovereign debt system is set up around unenforceable contracts,” Anna Gelpern, a Georgetown University law professor who specializes in this arcane area, told me. Scary thought, that.

So, when a country like Argentina defaults, strange things can happen. In years gone by, the U.S. Navy might show up demanding gold. Nowadays, we have epic legal clashes such as the one between Buenos Aires and Wall Street hedge funds, which has just culminated in victory for the hedgies at the U.S. Supreme Court.

Fought out in courtrooms and the pages of major newspapers, where the two sides hurled vitriolic rhetoric at each other in paid advertisements, the case pitted the irresponsible populists who ran Argentina into the ground against financiers who insisted on every last dollar owed them. Argentina’s hard-pressed people will be the losers no matter what happens, you can be sure.

Still, the hedge funds’ victory may ultimately serve the global public interest, if there is such a thing. For both sovereign debtors and those who would lend them money, it amounts to a needed reminder about the actual risks involved in borrowing and lending on lightly regulated global financial markets and, possibly, an incentive to deal with those risks more transparently.

(FILES) in this March 31, 2012 file photo, the US Supreme Court Building is seen in Washington, DC. (Karen Bleier/AFP/Getty Images)

Absent global bankruptcy law, countries and creditors seek a second-best solution: bond agreements, a key provision of which is that any disputes get decided in U.S. courts. Humiliating as that may be to the Argentinas of the world, no one would lend them money without contractually guaranteed recourse to a venue where the rule of law is well established.

The Supreme Court left intact New York court rulings to the effect that a standard provision of Argentina’s bonds, the pari passu clause, put a small minority of holdout hedge funds in line to get paid ahead of the majority that accepted pennies on the dollar when Argentina “restructured” its debts. And the courts put teeth in that ruling by forbidding other New York banks from facilitating bond payments by Argentina until the holdouts are satisified.

The legal reasoning was complex but boiled down to this: Tough luck, Argentina. You knew — or should have known — what you were getting into when you sold the bonds, which included a waiver of your sovereign immunity.

Checkmated, Buenos Aires faces this choice: Pay the hedgies $1.3 billion, which might open the door to an additional $15 billion in claims by others, or lose access to the U.S. financial system. A separate Supreme Court ruling empowers the hedge funds to identify Argentine assets around the world, the prelude to seizing them.

This threatens Argentina’s economy but probably not the world’s. To be sure, the Obama administration and the International Monetary Fund argue otherwise; according to them, a victory for the hedge funds creates a dangerous precedent for future sovereign debt crises. Their view is that tilting the legal balance in favor of potential holdouts would make it harder to negotiate restructuring deals when necessary for global financial stability. Certainly Greece’s creditors made the world sweat before finally accepting a “haircut” that enabled that country’s bailout.

But perhaps that status quo needed this shake-up. It may instill a new sense of caution in both borrowers and lenders, because now they’re on notice to deal with each other in frank anticipation of holdouts in the event of default. Already, many sovereign borrowers have written what are known as “collective action clauses” into their bond agreements; these try to avoid holdouts by requiring all of a particular country’s lenders to go along in the event a large majority accepts a restructuring.

Existing collective action clauses still have a lot of holes, but they do represent a model for tougher provisions that might be adopted after the Argentina case. As such, they’re a step in the right direction. They help the parties “price in” risk — which, in turn, helps them lend, and borrow, no more than they can actually afford.

Debt restructuring and IMF bailouts are, at best, a necessary evil. Along with preserving them as a last resort, we should be figuring out how to prevent them. And one way to do that is to discourage countries from living beyond their means in the first place.

Read more from Charles Lane’s archive, follow him on Twitter or subscribe to his updates on Facebook.