Two years ago, a chastened group of Democrats came to Berryville, Virginia. In a town of 4,300, in a Republican district they hoped to win, they unveiled a new economic agenda – A Better Deal: Better Jobs, Better Wages, Better Future. It was their roadmap back to power in 2018 – a populist pitch to voters who left them for Donald Trump.

“Too many Americans don’t know what we stand for,” Senate minority leader Chuck Schumer told a crowd in a park off Main Street. The new vision, he said, would change that.

Democrats took the House. It was a victory led by the likes of Jennifer Wexton, moderates who won seats long held by Republicans, such as that in which Berryville sits. But the most diverse freshman class in American history also included four politically combative progressives who arrived in Washington with massive online followings and what they believe is a mandate for change.

The ideological rift in the party has been exacerbated by the quartet’s outsize profiles. And six months into the new House majority, a border security bill was the match that set a fire.

For weeks the conflict raged in public view. Then Trump intervened and united them. The president’s racist attacks on the four congresswoman – Alexandria Ocasio-Cortez, Ilhan Omar, Ayanna Pressley and Rashida Tlaib, known collectively as “the Squad” – drew a swift response. Democrats uniformly approved a House condemnation of his remarks.

“We are a diverse caucus,” Wexton told the Guardian. “We have a lot of different views but at the end of the day we’re all on the same team.”

I don’t hear about socialism. I don’t hear about the Squad Jennifer Wexton

With few exceptions, Republicans refused to criticize the president and escalated their assault on the lawmakers as “socialist extremists” and “communists” who “hate America”, part of a strategy to tar an entire party. Kevin McCarthy, the House minority leader, told reporters this week that voters have a choice in 2020: “Socialism versus freedom.”

Statements like that are intended to make life difficult for Wexton and colleagues in districts more Republican-leaning than her own. Of the 67 Democrats in the 2018 freshman class, roughly one-third are from districts Trump won in 2016.

At a gathering of centrist Democrats last month, Joe Cunningham of South Carolina and Abigail Spanberger of Virginia pleaded with more liberal members of the party to consider how their words might reverberate beyond New York, Detroit or Boston.

“Where we sometimes go wrong is if we allow each other to – or try to – speak for the entire caucus,” Spanberger said, suggesting members bracket comments with “in my district”.

Wexton says Virginia 10, a diverse and affluent district from the suburbs of Washington to the West Virginia border, is not interested in Trump’s outbursts or Democratic drama.

“People want us to do something about health insurance premiums and prescription drug prices, which we are working on,” she said. “I don’t hear about socialism. I don’t hear about the Squad.

“We made it very clear that we condemn his remarks, that his remarks have no place in this country. And now we’re moving on to the many other things that are that our constituents care about.”

On Friday, Wexton visited two mosques, after Trump attacked Omar at a campaign rally and his crowd chanted: “Send her back.”

Omar, a Somali-born refugee to the US, is an American citizen and one of the first Muslim women elected to Congress.

‘They need a better economic message’

On a sweltering summer day in Berryville, few residents had heard about Trump’s latest controversy or the Democratic infighting. But they had strong views of Trump but a less clear view of the opposition party.

Michael Dunlap, who said he was probably one of the few Democrats in the area, chuckled when he heard the party had visited to roll out its policy vision.

“They need a better economic message,” he said. “That’s what people here care about.”

Waiting for a bus, Selma Galev said she voted for Barack Obama in 2008 but was dismayed by his immigration policies. Her family came to the US from Brazil when she was a child, an arduous process that placed financial and emotional strain on her parents.

“These immigrants at the border now are not coming the right way,” she said. “And they’re coming here and they’re flying their own flag, not the American flag.”

Galev said she was a devoted Trump supporter.

It’s up to the Squad. Will they accept that Democrats cannot possibly win with just their adherents? Larry Sabato

A few blocks away, William Townsend smoked a cigarette on his porch. When he heard what Trump said about the four lawmakers, he suggested it was the president who should “go back to real estate”.

Townsend hoped Democrats would nominate a “fighter” – but he also worried someone “too extreme” could play into Trump’s hands.

Gauging the electoral impact of the president’s most recent offense is tricky. A majority of Americans found the remark “un-American” and 65% found it “racist,” according to a USA TODAY/Ipsos Poll poll. But a Reuters/Ipsos poll found that Republican support for Trump climbed slightly after the comments.

“People have made up their minds completely about Donald Trump,” said Larry Sabato, the director of the University of Virginia’s Center for Politics. “I don’t think there’s anyone left to be converted. The election will be decided by who shows up.”

It will be a year before Democrats officially choose their nominee. Until then, Sabato said, “It’s up to the Squad. Will they accept that Democrats cannot possibly win with just their adherents – that Democrats must win independents and moderates?”

Virginians have twice rejected Trump’s politics of polarization, said Al Nevarez, a former chair of the Loudoun county Democratic committee.

Supporters cheer after Jennifer Wexton won the Virginia-10 district congressional election in November last year. Photograph: Andrew Caballero-Reynolds/AFP/Getty Images

In 2017, the Republican nominee for governor, Ed Gillespie, embraced the president’s rhetoric on crime and immigration, attacking his opponent on Confederate monuments, sanctuary cities and the Central American gang MS-13. The Democrat, Ralph Northam, won and his party made sweeping gains. In 2018, Wexton, Spanberger and Elaine Luria flipped three Virginia districts.

Trump’s suggestion that women of color “go back” to their country – and Republicans’ collective silence – could be a turning point for some conservatives who have not yet abandoned their party, Nevarez said.

“No statement speaks volumes right now,” he said.

‘Americans and Virginians’

Hassan Ahmad, an immigration lawyer in Sterling, Virginia, was ­a candidate for the Democratic nomination for a seat in the House of Delegates. He lost but said he was encouraged by what he heard knocking doors.

“People were not just concerned about issues that affected them,” he said. “They cared deeply about the issues that affected their identity as Americans and Virginians.”

The stakes are too high, he said, for Democrats to become distracted.

“If the division continues it will absolutely be used to pit the Democratic party against itself, and that will lead to a Trump victory,” he said.

Before leaving Washington this week, the factions agreed to truce. In a rare joint statement, leaders of the House Democratic Caucus and three ideological sub-caucuses called the party a “diverse, robust and passionate family” and vowed to “remain clear-eyed with respect to our unity of purpose”.

Trump’s provocations will likely only escalate as 2020 nears.

“We try to keep our eyes on the prize,” Wexton said, “and remember what people sent us here to do.”