TUCSON, Arizona — With acres of ranches, small southern border towns and most of populous Tucson, the landscape of Arizona's 2nd Congressional District is as varied as its swing seat electorate.

Just as varied is the field of candidates competing in this year's primary, where seven Democrats and four Republicans seek to succeed Republican Rep. Martha McSally. Her bid for U.S. Senate put the seat up for grabs, and it's a key pickup for Democrats who hope to take control of the House.

The Democratic candidates include former Congresswoman Ann Kirkpatrick, who represented another district then unsuccessfully challenged long-serving Sen. John McCain in 2016 — plus recurring candidate and physician Matt Heinz.

In the Republican primary, Lea Marquez Peterson has soared past her opponents in fundraising and ginned up support around Tucson, where she leads the Tucson Hispanic Chamber of Commerce.

The competitive primary races have yielded spates of partisan-fueled mudslinging. Democrats have hurled allegations of alliances with Republicans, and Republican candidates have criticized each other for not being conservative enough.

Despite the noise, the chair of the Cochise County Democrats Debbie Hickman says her members are focusing on voter education and registration efforts to drive turnout.

"We're all just holding our breath," she said. "But if we have a chance, it's right now."

The district is home to around 136,000 Democrats, 133,000 Republicans, and about 121,000 unaffiliated voters, according to state election data. The vast majority of voters live in Pima County, as the district covers a majority of Tucson, the state's second-biggest city and home to the University of Arizona. But around 69,000 voters out of around 394,000 live in the vast rural expanse of Cochise County.

Border security and immigration policy are top of mind for many voters, as the district is one of nine in the U.S. that touch the Mexico border. It also has a noted military presence: the Davis-Monthan Air Force Base in Tucson and Fort Huachuca in Sierra Vista, which is 75 miles to the southeast.

Stan Barnes, a Republican consultant, said the party's eventual nominee will have to "manage" a relationship with President Donald Trump, while the Democrat may be able to get by with the support of anti-Trump voters in Tucson. That might give the Democrat an edge, Barnes said, but he wouldn't discount what a positive economic climate might mean for Republican voters.

"The average voter is still voting in the voter's best interest," he said.

Voters here have elected representatives from both parties. The seat was once held by Democratic former Rep. Gabby Giffords, then former Rep. Ron Barber before McSally flipped it to red. In 2016, McSally beat Heinz with about 57 percent of the vote. That same election, voters in the district picked Hillary Clinton for president over Trump by about 5 percentage points, after narrow victories for the Republican nominees in 2012 and 2008.

This cycle, voters have seen their fair share of television ads, including attacks between Heinz and Kirkpatrick. She's backed by the Democratic Congressional Campaign Committee, giving her an edge among the party faithful and institutional resources. But Heinz, who previously served in the state legislature, has gone after Kirkpatrick with ads claiming she voted with Republicans on cuts to Medicare.

Heinz also funded a lawsuit that looked to kick Kirkpatrick off the ballot. The suit claimed she falsely claimed she lived in an apartment in Tucson when she filed for office, when she actually resides in a condo in downtown Phoenix. Kirkpatrick said she has been living in Tucson for more than a year, and the judge ruled that she had lived in Tucson when she collected petition signatures to appear on the ballot.

Then in an interview in the final week of the race, Heinz compared Kirkpatrick's repeated bids for office to a "meth addict."

Kirkpatrick a week prior had said she would no longer mention opponents in her mailers to make the primary more positive. But she responded to the comment on Twitter by saying she heard similar rhetoric as a young lawyer. "Matt, when women succeed, America is a better country," she tweeted.

Other Democrats seeking the nomination are Billy Kovacs, an entrepreneur; Mary Matiella, a former assistant secretary of the Army; Barbara Sherry, a rancher and former banking and mortgage professional; Bruce Wheeler, a former state lawmaker and ex-Tucson council member; and Yahya Yuksil, an attorney.

In an earlier controversy, Yuksil lost support from the Pima County Democratic Party and faced calls to end his campaign after the Arizona Daily Star reported a decade-old allegation that he raped an intoxicated 16-year-old girl while he was in high school. Yuksil wasn't charged and says he was never questioned by police.

All of the candidates, except Sherry and Yuksil, participated in a forum at a Tucson brewery hosted by NextGen Arizona, a voter registration and education effort backed by billionaire environmentalist Tom Steyer.

The light-hearted, attack-free forum was moderated by actor Josh Gad and put on display the policy commonalities between the candidates. All raised their hands in support of concepts like increasing clean energy and banning assault weapons, earning cheers from the crowd.

Democratic voter Val Ofiesh hadn't made up her mind when she went to the forum. And she wouldn't necessarily predict a victory for Democrats in November, as she says she knows many Republicans in the Tucson area.

"I'd be happy for it to go back to a Democratic district," she said. "I think a lot of Democrats would have to show up and vote."

Márquez Peterson is running in a four-way Republican primary with Brandon Martin,a former Army intelligence professional at Fort Huachuca; Danny Morales, former vice mayor in the border town of Douglas, Arizona, and Casey Welch, who has worked for the federal government in Afghanistan, Iraq and Colombia.

While Márquez Peterson has raised the most money and has establishment support, some of her opponents are looking to shore up their base in the rural portion of the district.

The Cochise County Republicans held their last monthly meeting before the primary earlier this month in Sierra Vista. Multiple attendees wore shirts supporting former state Sen. Kelli Ward, who is challenging McSally in the primary for a U.S. Senate seat. One man wore a hat branded "Trump 2020."

Across the room from a life-sized cardboard cutout of Trump, Martin gave a short campaign speech after shaking hands with attendees, some of whom wore his campaign T-shirts. He emphasized his recent endorsements from several ranchers and Sierra Vista connections — and called out the front-runner for her establishment ties.

"I can tell you there's not a lot of excitement for that Tucson swamp candidate," Martin told the crowd, referring to Márquez Peterson. "We have to rally Cochise County and turn out the vote."

He's also dubbed Márquez Peterson "Left Wing Lea" on a website that claims she's a "never Trumper" and shows photos of her with Democratic Rep. Kyrsten Sinema, who is pursuing her party nomination for the Senate seat being vacated by Sen. Jeff Flake.

Márquez Peterson, who has spent 40 years in the district and highlights her connections to the state and local economy, calls the moniker ridiculous.

"I have worked with all types of people and I can work to get things done regardless of politics," she told the Associated Press.