A dozen Alaska state legislators face challenges from within their parties during Tuesday's primary election.

In an unusual move, the Republican and Democratic parties -- generally reluctant to pick sides during a primary -- have gotten involved in some of the races.

All 40 House seats and half of the Senate's 20 seats are up for election. Two senators, Republican Bert Stedman of Sitka and Democrat Donny Olson of Golovin, are unopposed this year. Seven House Democrats, six of whom are in the minority, and Republican House Speaker Mike Chenault also face no opposition.

It is still possible for someone to run as a write-in candidate, however; the deadline for doing so is five days before the November election.

Republicans control both chambers.

The races will be held against the backdrop of a multibillion-dollar deficit that lawmakers have yet to close.

In all, nine legislators are giving up their seats, either because they aren't seeking re-election, or -- in the case of Reps. Lynn Gattis, Craig Johnson and Shelley Hughes -- they've opted to run for the Senate.

Earlier this year, state GOP leaders took the unusual step of endorsing George Rauscher over incumbent Republican Rep. Jim Colver of Palmer. Rauscher made a failed bid for the seat in 2014.

State Republican Chairman Tuckerman Babcock said the action wasn't taken lightly. But he thinks Colver is a Democrat who would organize with Democrats at the first opportunity.

Colver is part of the "Musk Ox Coalition," a loose affiliation of moderates in the Republican-led House who on a handful of issues have bucked leadership or aligned with minority Democrats.

Another "musk ox" facing a primary challenge, Republican Rep. Paul Seaton of Homer, is being targeted by a third-party spending group.

Colver, on his website, defends his voting record as one of the most conservative in the Legislature and said he works for his constituents -- not "party bosses."

In an interview, Colver said he's a proud member of the Republican-led majority and said there's nothing wrong with having some independence and different points of view within that group. He pegs his troubles with party leaders to his vote against a bill that would have put legislators on a gas line board. The bill passed the Legislature but was vetoed by Gov. Bill Walker. Colver saw the bill as unconstitutional -- a conclusion also reached by the attorney general's office.

"I guess the lesson is, if you don't go along with the flow and do what you're told, you might get thrown under the bus," Colver said.

The state Democratic party, meanwhile, has donated to the challengers of fellow Democratic Reps. Bob Herron of Bethel and Benjamin Nageak of Barrow. Herron and Nageak are among four Democrats in the House majority.

Herron is a leader within the majority who expressed frustration that pieces of the governor's plan to address the deficit weren't sent to the House floor for a vote. Nageak is a co-chair of the House Resources Committee.

State Democratic Party Chairwoman Casey Steinau said there was no formal decision by the party to back Herron challenger Zach Fansler and Dean Westlake, who made a failed run against Nageak in 2014. Fansler and Westlake asked the party for its support, Steinau said.

She said her party's goal is to get a "true bipartisan coalition" in the House that holds shared power.