KABUL, Afghanistan — In a bid to fend off the threat of a nationwide financial crisis, the Afghan and United States governments hammered together a deal to bail out Afghanistan’s largest bank on Saturday after lines of frantic depositors mobbed the bank for a third day.

Details of the deal were still being worked out on Saturday by the Central Bank of Afghanistan with assistance from the United States Treasury Department, Afghan and American officials said. But American officials said no United States funds were involved in the bailout.