PROVIDENCE, R.I. — Liberal-leaning Democrats who sought to upend Rhode Island’s political leadership in Tuesday’s state primary have cost several longtime Democratic lawmakers their seats in the General Assembly.

The Rhode Island Progressive Democrats, which pushed several of the challengers to run, called the primary election a “massive blow to the conservative machine within Rhode Island.”

State Democratic Party Chairman Joseph McNamara took a more measured approach, noting that losing incumbents were a minority in the 113-member Legislature.

He said the party has a “big tent” and will support all the Democratic primary winners 100 percent, even though it supported the incumbents leading up to the election.

Lawmakers who lost their seats included Sen. William Walaska and Rep. Eileen Naughton, both of Warwick, Rep. Jan Malik, of Warren, and Sen. Juan Pichardo, of Providence.

House Majority Leader John DeSimone, one of the most powerful members of the House, and Rep. Thomas Palangio were also behind in tight races to keep their seats representing the north end of Providence. DeSimone asked for a recount Wednesday after preliminary results showed him losing by 17 votes to Providence teacher Marcia Ranglin-Vassell.

Palangio is also seeking a recount. He was 21 votes behind activist and waitress Moira Walsh.

Walaska was defeated by Jeanine Calkin, who had worked on the Bernie Sanders presidential campaign. Malik lost to Jason Knight, a Barrington attorney who portrayed Malik as too conservative on gun rights. Warwick City Councilwoman Camille Vella-Wilkinson defeated Naughton. Providence city code inspector Ana Quezada defeated Pichardo in a race that centered more on political effectiveness than ideological differences. Walaska and Naughton were first elected in 1992, Malik in 1996 and Pichardo in 2002, as the state’s first Latino lawmaker.

Republicans had few competitive primaries Tuesday. An exception was in Cranston, where GOP National Committeeman Steve Frias defeated an opponent for the chance to compete against Democratic House Speaker Nicholas Mattiello in November’s general election.

For some Democratic lawmakers, the primary was the most competitive election in years.

Some newcomer candidates who challenged incumbents from the left said they were motivated to run after campaigning for Sanders, who beat Hillary Clinton by nearly 12 percentage points in the state’s April primary.

They also tapped into anti-incumbent sentiment after a series of scandals this year tarnished the Legislature’s Democratic leadership. Among the open seats Tuesday were two vacated by high-ranking Democrats, who were forced by scandals not to run for re-election.

“Certainly those types of scandals really hurt the perception of all elected officials,” McNamara said. “It tarnished people who worked very hard and were very dedicated.”

McNamara, a state representative from Warwick who ran unopposed, said voter turnout was so low that it favored candidates who were best at identifying their supporters and getting them to polling places.

DeSimone sought to hold onto the seat he’s represented since 1993 against a challenge by Ranglin-Vassell, who ran to the left of DeSimone on gun control, raising the minimum wage, criminal justice reform and other causes.

Ranglin-Vassell declared victory in an interview Wednesday. Although DeSimone signs dominated lawns in the district in the days leading up to the election, the Jamaican immigrant said she was “able to pull it off because I knocked on every single door.” She said her work as a high school teacher and being the mother of three sons gave her intimate knowledge of the problems of youth violence in Providence.

“I know those students. I know their names. I know some of the victims. I know some of the incarcerated,” she said.

DeSimone attracted negative attention earlier this year after it was reported that he was late in paying taxes. One voter who cast a ballot for Ranglin-Vassell in the city’s Charles neighborhood said Tuesday she was sick of an insider political culture in Rhode Island that lets legislators “just squat in their seats” for years.

“DeSimone’s been in there for a very long time and I don’t think he’s doing his job,” said Barbara Pothier, who runs a nonprofit charity. “He feels like he owns that seat. He needs to go.”

DeSimone didn’t return calls for comment Wednesday. State elections officials were expected to decide late Wednesday if his recount request was eligible.