On Friday, a New York state judge rejected a request from President Donald Trump‘s legal team to toss out a lawsuit that accused the president and his family of violating charity laws through their personal charity, the Trump Foundation.

Justice Saliann Scarpulla agreed with New York Attorney General Barbara Underwood that the suit should proceed, arguing that Underwood was correct in claiming Trump used his foundation to benefit his 2016 campaign.

Alan Futerfas, a lawyer who represents the president and his three eldest children, had reportedly maintained that Trump was simply acting alone and not on behalf of the foundation when he hosted a televised fundraiser for military veterans. Trump also allegedly instructed members of his campaign staff to decide which groups or individuals received donations. Futerfas argued that there was a lack of proper jurisdiction and that the New York attorney general’s office was biased against Trump.

However, Scarpulla said in her decision that the allegations reveal that “Mr. Trump was acting in both of his capacities as campaign candidate and president of the Foundation.”

SLIDESHOW: DONALD TRUMP’S 30 CRAZIEST TWEETS

Trump has previously called the lawsuit against him and his foundation “ridiculous” and politically motivated. He lambasted Underwood and her predecessor, the disgraced Democrat Eric Schneiderman, multiple times.

Underwood initially filed the lawsuit in June. In it, she alleged that Trump and his three eldest children — Ivanka, Donald Jr. and Eric — had routinely misused the Trump Foundation, which was first established in 1987, to pay off lenders of Trump businesses, to refurbish one of the president’s golf clubs and to launch a major raffle at several 2016 campaign events. Trump’s former personal lawyer Michael Cohen was even subpoenaed by New York state’s tax department as part of a probe into the Trump Foundation in August. 

According to The Washington Post, Scarpulla pointed out in her decision in this case that the result of this suit could also be tied to an unrelated case that is also pending in New York state: the defamation lawsuit brought by former Apprentice contestant Summer Zervos, who accused Trump of sexual misconduct.

Underwood became New York’s attorney general in May, after Schneiderman resigned amid explosive allegations that he had physically assaulted several former romantic partners. Democrat Letitia James, who won her bid for the state’s attorney general this month, will replace Underwood. Throughout her campaign, James stated she would continue the office’s investigations into Trump.