RALEIGH — Outside groups are spending millions to try to influence the political balance of North Carolina’s Supreme Court, with even Barack Obama weighing in with a rare endorsement in a state judicial contest.

Although justices don’t officially run as Republicans or Democrats, four have their voter registration with the GOP with the remaining three with the Democrats. If Wake County Superior Court Judge Mike Morgan — who received the president’s endorsement — unseats Associate Justice Bob Edmunds next week, it would tip the balance to Democrats for the first time since 1998.

The contest is occurring during this year’s highly partisan elections for president, U.S. Senate and governor in which North Carolina’s increasingly conservative shift is a key issue. Redistricting maps and a law allowing taxpayer money for private-school scholarships — both approved by Republican lawmakers — were upheld by the court’s GOP majority.

A slight swing to the left by the court could serve as a stronger balance to the General Assembly, which will likely remain in GOP control following the election.

Critics of Edmunds have spent close to $1 million running a television ad blasting his 2015 opinion upholding congressional and General Assembly district maps drawn by Republican legislators. Earlier this year, federal courts struck down both redistricting plans anyway, calling the boundaries illegal racial gerrymanders.

“Any time you’re trying the constitutionality of an act of the legislature, you can perceive it as a legal question, but it’s wrapped in the context of the politics of the decision,” former Associate Justice Bob Orr said in an interview.

In all, three groups have raised at least $2.8 million this fall to spend on this year’s lone North Carolina Supreme Court campaign, according to campaign reports at the State Board of Elections. The two candidates had spent roughly $300,000 on their campaigns combined during about the same period. Obama’s video endorsement of Morgan is separate from all of that.

“Mike understands what ordinary families are going through, and he has a track record of administering fair and impartial justice,” the president says in the video.

Two groups backing Edmunds are running a largely biographical ad and a quirky spot featuring doo-wop singers designed to raise his name recognition.

What laws could face more scrutiny by a court with a Democratic majority? Orr pointed to topics where the justices recently made 4-3 decisions along party lines. They include redistricting fights that are sure to continue and the taxpayer scholarships for K-12 private school students. Donors provide some insight on future pressure points.

Donations to the pro-Edmunds group Fair Judges include $99,000 from a political action committee called North Carolina Citizens for Freedom in Education, which is associated with the leading school-choice group in the state.

Another Fair Judges donor is Medical Mutual, a provider of physician medical malpractice insurance. Republicans at the legislature this decade have approved limits on monetary damages in malpractice lawsuits. The business-friendly North Carolina Chamber is also running a pro-Edmunds ad that’s bankrolled by a $1 million contribution from a legal reform arm of the U.S. Chamber of Commerce.

The U.S. Chamber group declined comment, but N.C. Chamber spokeswoman Kate Payne said in response to questions about the Edmunds ad “the judiciary has the power to dramatically impact North Carolina’s business climate. States with liability-restraining courts enjoy better business climates and growth potential.”

An affiliate of the Republican Legislative Leadership Committee, which previously made GOP control of redistricting in state legislatures a top priority, gave $300,000 to Fair Judges, records show.

Actual donors paying for the anti-Edmunds commercial about redistricting by the liberal-leaning North Carolina Families First are difficult to pin down. Elections filings attribute more than $1.5 million in recent donations to groups called Make North Carolina First and Real Facts NC. Federal tax filings don’t reveal the original sources of their money, although they list a former political aide to Democratic Gov. Mike Easley and founder of a Democratic-leaning polling firm among their recent leaders.

Michael Weisel, a Raleigh lawyer associated with all three groups but speaking for Families First, said North Carolina residents “deserve a state Supreme Court that fairly applies the law in an independent manner, and acts as a check on our legislature’s constitutional overreaches.”

By Gary D. Robertson

Associated Press