Tuesday’s primary pits DFLers and Republicans against their own kind in 13 House races that span the state, with a few particularly ferocious contests that are creating internal conflicts for both parties.

Nine races have Republicans challenging their party’s endorsed candidates, while six races feature DFLers running against other DFLers. Many of those offer just token opposition, but two races in particular have drawn statewide — and even national — attention.

In Eden Prairie, three-term Republican Rep. Jenifer Loon, a deputy minority leader in the House, has drawn a stiff challenge from GOP activist Sheila Kihne, in what may be the Legislature’s most expensive primary. The race has already drawn more than $100,000 from donors outside the district, largely over Loon’s earlier support of same-sex marriage.

In Minneapolis, a similar skirmish is underway among DFLers. Rep. Phyllis Kahn, who is seeking a 22nd term, is up against Mohamud Noor a Minneapolis school board member who has mobilized much of the local Somali community in a race that has divided the party. Kahn contends she has represented her increasingly diverse community well, while Noor says he is more in touch with the needs of the changing district.

Both legislative contests could alter the look and feel of the two parties. The Eden Prairie race could oust a Republican House leader in favor of someone more socially conservative, reopening the GOP debate on marriage. The Minneapolis race could end the career of one of the first women to serve in the Legislature, while ushering in the Capitol’s first Somali-American lawmaker.

Loon was one of just four Republican House members to vote for legalizing same-sex marriage in the 2013 legislative session. One opted not to run for re-election, while another was ousted by party activists earlier in the season. Rep. Pat Garofalo of Farmington emerged unscathed.

For Loon, the fallout from that vote continues.

“This primary is about integrity. It’s about leadership. And it’s about what it means to be truly conservative,” Autumn Leva, director of legislative affairs and communications for the Minnesota Family Council, said of the Loon/Kihne race. The Family Council, which waged a hard fight against gay marriage, has spent undisclosed sums to defeat Loon and support Kihne.

Loon has defenders within her party, chief among them House Minority Leader Kurt Daudt, of Crown.

“I think people in that district respect that she stood up and made a stand,” said Daudt, who voted against legalization himself, but who is supporting Loon’s re-election bid.

Loon has raised about $90,000 for her campaign, edging out most incumbents. She’s also drawn support from a new political action committee. The Freedom Minnesota PAC has raised $25,000 from wealthy gay marriage supporters across the county.

“When she voted for [gay marriage] I was very proud of her,” said district voter and Loon contributor Barbara Farrell. The Eden Prairie district in 2012 was among the communities that voted against a constitutional amendment that would have banned gay marriage.

“Sheila has a huge uphill battle,” said Sen. Dave Osmek, a Republican from Mound and a Kihne supporter.

The Minneapolis race between two Democrats could be equally telling for the party’s representation in one of its core districts. The contest has divided the district’s sizable East African community and featured legal challenges and allegations of racism.

Kahn, 77, has held the seat since 1972. She helped pass one of the earliest bans on public smoking and proposed laws to help women in the workforce. She worked with Noor and other East African immigrants last year to elect Abdi Warsame, the first Somali-American to the City Council.

Months later, after being appointed to the Minneapolis school board, Noor, 36, announced he would run for Kahn’s House seat. His mobilization of Somali immigrants and other voters helped block a DFL endorsement for Kahn in the spring.

Noor, like Warsame, has put considerable effort into bringing hundreds of voters to City Hall to cast early ballots.

Both candidates promote progressive views in the district spanning Cedar-Riverside, the U, Prospect Park, Seward and Nicollet Island. Noor, however, claims he has more in common with constituents in a district with many young people and racial minorities.

Recently, Noor walked by a row of Kahn signs to make his pitch door to door in Seward.

“The district has changed,” he told one undecided voter. “And the needs of people have changed. … I will focus on educational issues, closing the opportunity gap.”

Karen Utter, a voter Noor addressed, wondered aloud whether Kahn has been in office for too long, but also voiced concerns that Noor had just started on the school board.

“I just don’t know,” she said of the two options.

Kahn also made a final push this week, knocking on doors in Prospect Park and telling residents it was important to show up Tuesday.

“It’s a very contentious primary,” Kahn told voters.