CHESTERFIELD, Va. — Abigail Spanberger had come to the heart of the resistance, a place where suburban women infuriated by President Trump rose up last year and helped a Democrat running for governor win their county for the first time since 1961.

Yet the Democrat and former CIA operative, in a tight race against Rep. Dave Brat (R), never mentioned Trump as she addressed party activists at a recent Chesterfield County picnic. Her task was to stir simmering rage without bringing it to a boil.

“For every person in this outdoor space that has felt anxiety or sadness or fury about what we’ve witnessed — the lack of decency, the lack of civility — channel it,” said Spanberger, 39. “Channel it into excitement over who we are as a people and what we want to affirm with our vote and our voice.”

While “resistance” has been a rallying cry for Democrats elsewhere, Spanberger is trying to capture that energy without turning off the president’s fans.

Brat is caught in a similar balancing act in a district with a mix of rural communities still enthralled with Trump and suburban areas where he has energized Democrats as never before.

Brat was an economics professor in 2014 when he rocketed to Congress with tea party backing, defeating then-Majority Leader Eric Cantor in a stunning rebuke to the GOP establishment. Since then, he joined the hard-right Freedom Caucus and has been an ally of President Trump.

But now, concerned about a backlash from suburban college-educated voters — women in particular — Brat is trying to project a moderate image. Ads show him with his wife, son and daughter, surrounded by frolicking puppies. In an interview, he compared himself to an iconic Democrat.

Dave Brat puppy ad

“I’m basically in agreement with JFK with everything he was for — supply-side tax cuts, he was proud of his Catholic faith, strong on defense, strong on the border,” Brat, 54, said about President John F. Kennedy. Virginia’s sprawling 7th Congressional District, stretching from Culpeper County to Nottoway County in the central part of the state, is bellwether for midterm elections that will determine whether Republicans hold onto the House. Although it is a longtime GOP stronghold, Republican margins have shrunk as its suburban sections have grown more populous and diverse. New boundaries in 2016 further improved chances for Democrats.

Republican presidential candidate Mitt Romney won it by 11 percentage points in 2012. Trump won it by six points in 2016. In the 2017 governor’s race, Republican Ed Gillespie beat Democrat Ralph Northam there by less than four points.

Why a historically conservative county in Virginia is making national Republicans nervous

Democrats and Republicans agree that Spanberger is the strongest opponent Brat has faced since Cantor, who seemed not to take the upstart seriously until it was too late. After winning reelection two years ago by 15 points, Brat now finds himself in the fight of his life. Public polls and independent analysts deem the race a toss-up.

“I’d say it’s a 50-50 deal right now, a coin flip,” said Tucker Martin, a longtime GOP strategist. “It’s obviously a district built to be won by a Republican, but the nature of a wave means it’s in play. And the realignment going on in American politics right now means it’s in play. The district has a lot of traditional Republicans in the suburbs who are currently undergoing a shift, as was witnessed last year when Governor Northam did the unthinkable and won Chesterfield.”

Spanberger has outraised Brat $4.95 million to his $2.4 million, with a $3.6 million third-quarter haul that was more than triple his. Outside groups pumped a total of $2.2 million into TV and social media ads in the first 12 days of October. On a trip to Richmond to help another Republican candidate last week, Vice President Pence posed for photos with Brat. One GOP strategist expressed frustration that Brat needs help in a district built to favor Republicans.

“The national committees — in a cycle in which they’re fighting to hold onto competitive swing districts — are having to spend money in an ‘R plus 7’ district to save a member who routinely pokes his finger in the eye of the people who are in the process of saving him,” said the strategist, who spoke on the condition of anonymity in order to be frank.

Rep. Dave Brat: “The women are in my grill no matter where I go”

Brat embraces the president’s tax cuts and regulatory rollbacks, and his efforts to dismantle the Affordable Care Act and harden the nation’s borders. He casts all of those measures as ways to help ordinary Americans.

Spanberger is on the other side of most of Trump’s agenda, but she telegraphs that carefully. She objects to the tax cuts in a way that seems aimed at liberals and fiscal hawks alike — as both a gift to big business and a $1.9 trillion addition to the federal deficit. She calls for both comprehensive immigration reform and strong borders.

On health care, she backs the Medicare X plan from Sen. Tim Kaine (D-Va.) to give non-elderly Americans the option to buy into the program — not the sweeping Medicare-for-all overhaul proposed by Sen. Bernie Sanders (I-Vt.). She says she would not support Rep. Nancy Pelosi (D-Calif.) for speaker.

Spanberger’s campaign has leaned heavily on her biography, playing up her credentials in national security, federal law enforcement and suburban motherhood. She has recruited spies for the CIA, busted drug traffickers as a postal inspector and led a Girl Scout troop as a mother of three girls.

“Dave has certainly tried to run on the Trump economy, which is smart for the Republicans,” said Bob Holsworth, a former Virginia Commonwealth University political scientist. “And I think Spanberger’s doing everything right for that district. The question is, can she overcome its natural tilt?”

Brat, a man of religion and economics

Brat grew up in Alma, Mich., a rural community he describes as “right in the exact middle of the mitten.” He was the oldest of three boys born to a family practitioner and nurse.

“We got to grow up with barns and had a riot,” he said. “We had a river-swamp running through our backyard, and we’d go out and hunt for crayfish every day. Just loved it.”

The Brats were not a very political family, but they were churchgoers. His father, who went to seminary in retirement and now does hospice work, was forever on the hunt for the best preacher. He was not a stickler for denomination. One week the family might settle into the pews of a Presbyterian church. The next, Methodist. Swedish Covenant, perhaps, after that.

That religious flexibility is evident today. Brat attends St. Mary Catholic Church in Henrico because his wife is Catholic and the preaching’s good.

In high school, Brat was on the debate and tennis teams while also playing trumpet in the band and in the Minnesota Youth Symphonies. He considered studying music. Or entering seminary. Or going into business. Or academia.

After earning a business degree from Hope College in Holland, Mich., a master’s in divinity from Princeton Theological Seminary in New Jersey, and a PhD in economics from American University, Brat managed to roll his disparate interests together as an economics professor specializing in the intersection of capitalism and Christianity.

At Randolph-Macon College in Ashland, Va., where he taught for nearly two decades and chaired the economics department, he espoused a theory that the best way to promote justice is through free markets.

Randolph-Macon biology professor Charles Gowan found Brat’s philosophy “a little too laissez-faire” but they are friends.

“I’ve rarely met anyone whom I respect so much for their sincerity and disagree with so much for their views,” Gowan said.

Brat boiled down some of his thinking into a speech with a catchy title: “Would Jesus drive an SUV?” (The short answer: yes, if he was using the SUV to “create a great, loving society;” no, if it’s to “load it up for your own personal pleasure.”)

That caught the attention of state Sen. Walter Stosch (R-Henrico), who enlisted Brat’s advice on education. For years, the professor volunteered for Stosch, a moderate who saw Brat as “an excellent partner” — and as someone who might have a political future.

When a state delegate resigned in 2011, Brat wanted to go for the seat. But a four-person GOP nominating committee chose then-28-year-old Peter Farrell — the son of Tom Farrell, chief of Dominion Energy and a prolific political donor.

Va. delegate and son of Dominion Resources CEO says he is his own man

Brat blamed the “Cantor machine” that held enormous sway over Richmond-area politics, said state Sen. Amanda Chase (R-Chesterfield), a friend of Brat’s and Cantor’s former political director, who was disillusioned by the episode. Brat got his revenge three years later by unseating Cantor, who declined to comment for this article.

“If you wanted to run for office, you needed approval from the Republican godfathers,” Chase said. “And Dave didn’t get that tap.”

Spanberger goes from the CIA to politics

Abigail Spanberger was fascinated with foreign languages from the time she was a little girl with a babysitter from Ecuador. Way before she mastered Spanish and French and Italian and German well enough to recruit spies overseas for the CIA, she liked to speak in accents.

“Any place where nobody knew us . . . she’d always want to pretend that she was an exchange student,” said Hilary Scribner, one of her two sisters.

Spanberger was the oldest of three girls born in New Jersey to a cop and a nurse. Her father soon moved into federal law enforcement for the U.S. Postal Inspection Service, where she would later work.

The family moved as he was promoted — up to Maine, back to New Jersey, over to Pennsylvania and then to suburban Richmond, where they finally put down roots. They settled in Short Pump, in western Henrico County. Back then, it was all farmland but for a Walmart, Wendy’s and the brand-new subdivision where the Spanbergers built a house on a lot with a stream out back.

Spanberger enrolled in a county high school with a Spanish immersion program, while keeping up with French. At the University of Virginia, she added German and Italian. She went on to earn an MBA in Germany through a Purdue University program.

“We used to jokingly say she was going to be president,” said Val Gooss, who chaired the immersion program at J.R. Tucker High School. “A lot of students are very highly motivated. . . . The difference with Abby was her true zest for knowledge was just that — it wasn’t just checking a box, ‘Oh I’ve taken three AP language classes. I’ve taken advanced this or that.’ She wanted to know.”

Spanberger’s curiosity about other cultures drew her to a long-term substitute teaching job that became fodder for attack ads this year. She’d gotten a conditional job offer from the CIA and was waiting out the long security-clearance process when she filled in for a teacher on maternity leave from the Islamic Saudi Academy in Alexandria.

Spanberger, who taught “Hamlet,” “Jane Eyre” and “Wuthering Heights,” saw herself as an ambassador of sorts, representing the United States to foreign students who would return overseas.

A super PAC aligned with House Speaker Paul D. Ryan (R-Wis.) took a darker view. Critics dubbed the Saudi-funded school “Terror High” because some students later joined al-Qaeda. The Congressional Leadership Fund, which learned about the teaching gig from a highly confidential security-clearance application that the Postal Service says it mistakenly released, has been running ads suggesting Spanberger aided terrorists.

The teaching stint did not give pause to the Postal Inspection Service or CIA, which were aware of it when they subsequently hired her and granted her security clearances.

Spanberger worked for the CIA from 2006 to 2014. Although her work remains classified, she said that it involved “recruiting and handling” foreign spies.

“All I knew was she was a clandestine operative,” Scribner said. “She had multiple passports and wigs.”

Spanberger was free to disclose only the barest details to family.

“It’s a burden for people to know,” Spanberger said. “I told my dad and my dad said, ‘I don’t think you should tell your mom because she’ll worry.’ And frankly, she is a terrible liar. When I finally did tell her, her first question was, ‘Did your father know?’ ”

Spanberger was the rare working mom in the ranks of CIA operatives. Her husband, Adam, a computer engineer, helped make that possible by working from home.

“I would say the pregnant lady waddling through foreign cities is easily overlooked,” she said.

Spanberger made the hard decision to leave the CIA four years ago so her children — Claire, now 10; Charlotte, 7; and Catherine, 4 — could be closer to family in the Richmond area.

Spanberger was barred from political activity while at the CIA under Presidents George W. Bush and Barack Obama. She got active for the first time during the 2016 election, and continued through the governor’s race last year. She decided to run for office the day last year that Brat and other House Republicans voted for a replacement of the Affordable Care Act — ultimately scuttled in the Senate — that the Congressional Budget Office said could unravel insurance markets and spike premiums, especially for people with preexisting conditions.

She said her husband was all in.

“He followed me to the CIA,” she said. “This is perhaps not the craziest leap of faith he’s taken with me.”