ONE of the perks of owning a bank is the ability to tap it when you need money. The Indian government, which has majority stakes in 21 lenders, is no exception. As it happens, it needs to finance a bail-out of the banks it owns, most of which are in trouble. So under a cunning plan unveiled on October 24th, the ailing banks will lend the government 1.35trn rupees ($21bn), about a third of their combined market value. The government will reinvest this money in bank shares, thus ensuring they no longer need a bail-out.

Steadying a tottering financial system is never a graceful exercise, as American and European authorities discovered after the financial crisis. India’s lenders withstood the meltdown of 2007-08 well, but then embarked on an ill-advised lending spree, backing lots of infrastructure projects that got snarled in bureaucracy. Bad loans piled up. State-owned lenders, which account for around two-thirds of the sector, now have “stressed” loans of 10.5trn rupees, about a fifth of their book.

Banks have been reluctant to acknowledge that money they have lent is unlikely to be repaid, in part because that would trigger a loss, which in turn depletes the bank’s equity (the money shareholders invest). State-owned banks already have equity levels close to regulatory minimums, so they have preferred to pretend that even their ropiest borrowers will pay them back in full. At the very least, they don’t have the capacity to extend new loans. Predictably, bank-credit growth has slumped, recently nearing record lows. That is one reason why year-on-year GDP growth slowed to 5.7% in the second quarter, from well over 7% a year ago.

Despite the roundabout method of recapitalisation, getting money into the banking system is good policy. Bankers are being encouraged to use a new bankruptcy code to deal with bust borrowers; having fresh equity makes it easier for them to acknowledge past mistakes and move on.

Details of the bail-out scheme are pending, but may resemble a rescue plan in the 1990s, whereby banks financed “recapitalisation bonds” issued by the government. The proceeds were used to subscribe to banks’ rights issues. (Banks will have to raise 580bn rupees themselves, perhaps by selling non-core assets, and receive a further 180bn rupees from government coffers left over from a previous scheme.) One attraction is that the money the government will have to borrow, roughly 1% of GDP, will not be reflected in its deficit, saving the finance ministry’s blushes.

The prospect of fresh funds sent most state-owned banks’ share prices soaring by well over 25%. Unlike recent Indian bank-rescue schemes, the package is large enough to make a difference. It should allow banks to lend again, if they can find willing borrowers. Indian businesses have plenty of spare capacity and many are still over-indebted. Some are still dealing with the effects of a sudden “demonetisation” of the economy last November, which has dented output. The complex implementation of a new goods-and-services tax in July has also frayed corporate confidence.

The government also says its banks will be run more efficiently, to prevent further incontinent lending. There is reason to doubt that. Reform of their corporate governance is long overdue; and letting the private sector take over the reins at public banks remains taboo. Still, repair of the balance-sheets is at last under way.