A New York judge on Friday rejected a bid by President Trump’s lawyers to throw out a lawsuit filed by the state's attorney general against the Trump Foundation.

The suit claims that Trump used the foundation’s charitable assets to pay off his legal obligations, promote Trump hotels and businesses, and make personal purchases. The suit also claims that the foundation “illegally provided extensive support to his 2016 presidential campaign by using the Trump Foundation’s name and funds it raised from the public to promote his campaign for presidency.”

The lawsuit is seeking $2.8 million, the dissolution of the foundation and a 10-year-ban on Trump running any charities.

"As we detailed in our petition earlier this year, the Trump Foundation functioned as little more than a checkbook to serve Mr. Trump's business and political interests," Underwood said in a statement Friday. "There are rules that govern private foundations -- and we intend to enforce them, no matter who runs the foundation."

Trump’s lawyers had called for the suit to be dismissed as they claim it was politically motivated. Attorney General Barbara Underwood, a Democrat, replaced former AG Eric Schneiderman in May -- who started investigating the foundation in 2016.

NEW YORK AG FILES LAWSUIT AGAINST TRUMP FOUNDATION FOR ALLEGED 'ILLEGAL CONDUCT;' TRUMP SAYS HE WON'T SETTLE

Trump accused Schneiderman, who resigned over allegations he abused women he dated, of not having “the guts” to bring the suit while he was in office.

“The sleazy New York Democrats, and their now disgraced (and run out of town) A.G. Eric Schneiderman, are doing everything they can to sue me on a foundation that took in $18,800,000 and gave out to charity more money than it took in, $19,200,000. I won’t settle this case!” Trump tweeted in June.

“Schneiderman, who ran the Clinton campaign in New York, never had the guts to bring this ridiculous case, which lingered in their office for almost 2 years. Now he resigned his office in disgrace, and his disciples brought it when we would not settle,” Trump added, moments later.

State Supreme Court Justice Saliann Scarpulla said on Friday that there was no basis for finding that “animus and bias were the sole motivating factors” for the lawsuit.

Trump’s lawyers, however, are confident that they will ultimately beat the suit.

"The decision means only that the case goes forward," Trump lawyer Alan Futerfas said in a statement. "As we have maintained throughout, all of the money raised by the Foundation went to charitable causes to assist those most in need."

A spokesperson for the Trump Foundation, in a statement to Fox News in June, called the lawsuit “politics at its very worst,” noting that the foundation has donated over $19 million to charitable causes “more than it ever received.” The spokesperson also said Trump contributed himself, or through his companies, more than $8 million, noting that the organization “was able to donate more than it took in” because “it had little to no expenses.”

Trump’s lawyers argued that a sitting president can’t be sued in state court over conduct outside official duties. But Scarpulla wrote in her ruling that allowing the Trump Foundation case to proceed is consistent with Supreme Court’s 1997 ruling that forced then-President Bill Clinton to face a federal sexual harassment lawsuit.

Scarpulla said in the ruling Friday that she would be forced to drop Trump from the lawsuit if a state appeals court ruled that a sitting president can’t be sued in state court.

Fox News' Brooke Singman and The Associated Press contributed to this report.