A judge in Manhattan has rejected arguments about presidential immunity and political bias and ruled that a lawsuit against the Trump family charity can proceed.

The New York state attorney general filed the civil suit in June, alleging that Donald Trump and his children Donald Trump Jr, Eric Trump and Ivanka Trump ran the Donald J Trump Foundation “in persistent violation” of state and federal law.

The office claimed the charity was used as a “piggy bank” to boost Trump Sr’s 2016 presidential campaign, violating rules that bar not-for-profit groups from engaging in certain types of political activity.

The suit claims that up to $3m in such funds boosted Trump’s campaign. Among examples of allegedly improperly used funds is the allegation that the charity spent $10,000 on a giant painting of Trump himself.

On Friday, the Manhattan supreme court justice Saliann Scarpulla found that the president was not “immune” from state lawsuits, as Trump has claimed in other litigation.

Pointing to Clinton v Jones, a 1997 US supreme court decision which permitted a sitting president to be sued, Scarpulla noted that the commander-in-chief is “subject to the laws” for unofficial acts, which would include involvement with a charity prior to taking office.

Scarpulla recognized that the supremacy clause of the US constitution, which holds that federal law “shall be the supreme law of the land”, bars state courts from getting in the way of presidential duties.

But in this case, she said, “the allegations raised in the petition do not involve any action taken by Mr Trump as president and any potential remedy would not affect Mr Trump’s official federal duties”.

Scarpulla also rejected claims that anti-Trump bias so permeated the office of the state attorney general that the suit needed to be thrown out.

The former New York attorney general Eric Schneiderman, who resigned in May following allegations of physical assault, was a longtime Trump foe, Trump family lawyers claim.

“It is not within the province of the courts to subjectively determine the motivation of a government agency in commencing an enforcement proceeding, or to dismiss the proceeding because of the political disagreements of the parties,” Scarpulla wrote in her 27-page decision. “Instead, it is my responsibility to review the petition to see if it has legal and factual support and if it does, to resolve it.”

Scarpulla also said: “Finally, given the very serious allegations set forth in the petition, I find that there is no basis for finding that animus and bias were the sole motivating factors for initiating the investigation and pursuing this proceeding.”

Alan Futerfas, the attorney defending the Trump family, did not immediately respond to a request for comment.

Schneiderman’s successor as state attorney general, Barbara Underwood, heralded the ruling in a statement.

“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,” she said.

“There are rules that govern private foundations – and we intend to enforce them, no matter who runs the foundation. We welcome Justice Scarpulla’s decision, which allows our suit to move forward.”

The question of presidential immunity in state lawsuits is playing out in another Trump case, involving Summer Zervos, a former contestant on The Apprentice who is suing the billionaire for alleged defamation.

The judge overseeing the Zervos case ruled that presidents can be sued in state court. Trump’s lawyer fought that decision in a state appeals court, which has not yet ruled.

A ruling in favor of Trump could alter the course of the charity lawsuit, possibly requiring Scarpulla to reconsider claims of presidential immunity.