MZ-3A, the U.S. Navy's only airship currently in operation, in this handout photo provided by the U.S. Navy. Helium is considered a vital element in industries including aerospace and defense. REUTERS/Adam Henderson/U.S. Navy/Handout via Reuters (HANDOUT/REUTERS)

The Senate on Thursday approved a bill that would stave off the impending shutdown of an oddball — but highly necessary — government program, the Federal Helium Program.

Under that program, the U.S. government stores vast amounts of the gas in a rock formation under Texas, then sells it for use in everything from party balloons to MRI machines. But the program is due to shut down Oct. 7, as a result of a law passed in 1996.

That law was intended to be a victory for small government, ending a program from the age of zeppelins, and getting Washington out of the helium business.

But now, it looks like a disaster, since there are not sufficient private sources of helium to take the federal program’s place.

A closure could mean a shortage of helium, which could affect both medical facilities and laboratories that use the gas in low-temperature research. The federal program sells off portions of its helium every year, accounting for about 42 percent of the U.S. supply of the unrefined gas. The program, with about five employees, pays for itself with proceeds from the sales.

The Senate bill would extend the helium program, although it has provisions to auction of much of the remaining reserve to private companies. In the long run, said Sen. Ron Wyden (D-Ore.), “it gets the government out of the helium business.”

The bill passed Thursday by a vote of 97 to 2. Sen. Jeff Sessions (R-Ala.) and Sen. Ted Cruz (R-Texas) voted “no.” Cruz spoke ahead of the vote, saying he supported a version of the bill passed by the House, because he said it allotted a more significant fraction of money made from helium sales to deficit reduction.

President Obama indicated Thursday that he supported the Senate version of the bill. Now, the House and Senate will have to iron out differences between the two bills, with the deadline still looming in early October.