DETROIT — The pension plans at General Motors and Chrysler are underfunded by a total of $17 billion and could fail if the automakers do not return to profitability, according to a government report released Tuesday.

Both companies need to make large payments into the plans within the next five years — $12.3 billion by G.M. and $2.6 billion by Chrysler — to reach minimum funding levels, according to the report, prepared by the Government Accountability Office. Whether the companies will be able to make the payments is uncertain, the report concluded, though Treasury officials expect the automakers will become profitable enough to do so.

If either company’s plan must be terminated, the government would become liable for paying benefits to hundreds of thousands of retirees. The effect on the government’s pension insurer, the Pension Benefit Guaranty Corporation, would be “unprecedented,” the report said. The agency manages plans with assets totaling $68.7 billion, less than the $84.5 billion in G.M.’s plan alone.

The carmakers’ pension plans were jolted by the downturn, increased liabilities and other factors. G.M.’s plan was overfunded by $18.8 billion in 2008, and was then underfunded by $13.6 billion last year, the report said. Chrysler’s plan was overfunded by $2.9 billion in 2008 but underfunded by $3.4 billion last year.