CHICAGO (Reuters) - The sale of $10 billion of general obligation bonds in 2003 and $6 billion in 2017 by Illinois was unconstitutional because the proceeds were used for loans to the state’s pension funds or to finance budget deficits, according to a court filing on Monday.

A petition to file a taxpayer complaint against Illinois’ governor, comptroller and treasurer was filed in Sangamon County District Court seeking to stop $20 billion of future state payments, including interest, on about $14.5 billion of the debt that remains outstanding.

State officials said the challenge was without merit.

The petition said Illinois’ constitution permits the issuance of long-term debt only to fund “specific purposes” like capital improvements.

“Simply obtaining cash to finance the state’s structural deficits or to speculate in the market is not a ‘specific purpose,’” it said.

The pending lawsuit also cites Illinois’ credit ratings, the lowest among U.S. states at a notch or two above junk, and an “unsustainable” debt burden that includes a $133.5 billion unfunded pension liability.

Illinois Comptroller Susana Mendoza said the “ridiculous lawsuit” misrepresents the constitution and is aimed at scaring bondholders.

A spokeswoman for Democratic Governor J.B. Pritzker, who took office in January, said several layers of lawyers signed off on the bonds’ legality.

“This is simply a new tactic from the extreme right to interfere in capital markets. We’re done with the far right’s dangerous financial games to pull Illinois underwater,” spokeswoman Emily Bittner said.

John Tillman, CEO of the Illinois Policy Institute, a conservative think tank, is the taxpayer plaintiff, while New York-based investment firm Warlander Asset Management is suing as an owner of $25 million of other Illinois bonds the lawsuit claims are at risk of default because of the payments on the “unconstitutional” debt.

Illinois used proceeds from the 2003 taxable bond sale for its underfunded employees retirement system. The plaintiffs claim most of the money was a loan to the pension funds to boost their investment income. Money from the 2017 bonds was used to pay overdue bills that had reached a record-high $16.67 billion as a result of a two-year state budget impasse.

Nearly $9 billion of the 2003 bonds mature in 2023 and 2033 and $5.5 billion of the 2017 bonds are due between 2020 and 2029.

The constitutionality of over $6 billion of Puerto Rico’s GO bonds is being challenged by the bankrupt U.S. commonwealth’s federally created oversight board.