A federal judge ruled in favor of Gov. Paul LePage in his court battle with House Speaker Mark Eves on Tuesday, dismissing Eves’ lawsuit against the Republican chief executive.

Eves, a Democrat, sued LePage last July because the governor had threatened to cut state funding to Good Will-Hinckley, a nonprofit in Fairfield that operates a charter school, when it hired Eves to be its president. The school subsequently withdrew its offer to Eves.

The 44-page decision by U.S. District Judge George Z. Singal came less than a month after attorneys for Eves and the governor argued the case before him in Portland.

Eves’ attorney, David Webbert, said he would appeal Singal’s ruling to the 1st U.S. Circuit Court of Appeals in Boston.

“The governor is pleased with the result, and appreciates the careful attention and decision of the court,” LePage’s attorney, Patrick Strawbridge, said in an email Tuesday afternoon. “We remain confident that this case is without merit, and will continue to defend it vigorously should the speaker decide to appeal.”

Maine Republican Party Chairman Rick Bennett issued a statement praising the dismissal.

“I am not surprised that the spurious, politically motivated lawsuit by Speaker Mark Eves against our governor was dismissed by the courts,” Bennett said. “The governor … appropriately challenged the prevailing sentiment in the State House that simply becoming a presiding officer in the Legislature suddenly qualifies a person for any publicly funded job. This is a good day for the Constitution and a good day for accountability in state government.”

Strawbridge had argued that LePage was making a legally protected political statement when he successfully persuaded Good Will-Hinckley to fire Eves and therefore had immunity from Eves’ claim, or was otherwise protected by the First Amendment right to freedom of speech.

Eves accused the governor of using taxpayer money and the power of his office to prevent his hiring by Good Will-Hinckley, and contended that LePage’s actions violated several of Eves’ constitutional rights, including his First Amendment rights of free speech, free association and political affiliation, as well as his 14th Amendment right to due process.

Good Will-Hinckley serves youths through a host of counseling programs and support systems, and also runs a charter school that is partially funded by the state.

In a technical and nuanced decision, Singal said that however coarse or distasteful Eves found the governor’s actions, they did not breach Eves’ constitutional rights. The judge found that LePage was entitled to qualified immunity because the statements he made about Eves did not constitute a threat to bring government power to bear against a private person or group, but were rather an “attempt to ensure that a public expenditure would be utilized to achieve a policy goal related to charter schools for at-risk youth.”

Officials are not protected for speech that is threatening, coercive and intimidating so as to convey that punishment, sanction or adverse regulatory action will imminently follow, Singal wrote. In assessing whether the speech by an official falls outside the limits of protected speech, the judge said, the court must determine whether the threat of withholding discretionary funding constitutes a threat of imminent punishment.

Eves “urges this court to conclude that an act by (LePage) to withhold discretionary funds from (Good Will-Hinckley) would have amounted to a form of punishment for employing (Eves) as president,” Singal wrote. “However, (Eves) has not presented, nor has the court found, any legal authority that concludes that impoundment of discretionary funds is equivalent to more traditional punishments that may be levied against an entity such as a fine or the loss of an operating license.”

In rejecting Eves’ claims, Singal also said the nature of the dispute was ill-suited to courtroom resolution. He noted that courts have found the preferred solution to political disputes is through the democratic electoral process.

Webbert disagreed, and said he believes the ruling will be overturned on appeal.

“We are confident that the court of appeals will agree that Governor LePage violated the basic rules of our Constitution when he used taxpayer money to blackmail a private organization into firing his political opponent for partisan purposes,” Webbert said in a written statement. “Mark Eves is determined to hold Governor LePage accountable for his abuses of power that undermine our democracy.”

The dispute over funding for the school began June 5, 2015, the day Eves signed a two-year employment contract with the school.

LePage phoned Richard Abramson, then interim president of the school, the same day and expressed his extreme displeasure about Eves’ selection.

LePage also sent a handwritten note to the chairman of the school’s board of directors, called Eves a “hack” and made it clear that the school would lose the $1.06 million in discretionary funding that it expected to receive in the upcoming two-year budget cycle.

The dispute arose as the Legislature worked to finalize the state’s budget and marked a particularly frigid moment between legislators and LePage, who vowed to veto every bill sponsored by a Democrat because members of the House did not address his policy priorities.

The Good Will-Hinckley board rescinded its offer to hire Eves as its president on June 24.