PITTSFIELD — Andrea Harrington, a Richmond attorney whose progressive message won over Democratic primary voters, has fended off a write-in challenge to become the next Berkshire district attorney.

Shortly after 9 p.m. Tuesday, it became apparent that the campaign by incumbent Paul Caccaviello had fallen short.

"It is over," said Barry Clairmont, a former Pittsfield city councilman and Harrington supporter, prompting a roar from the jubilant crowd gathered at Tavern at the A in Pittsfield.

Harrington took the stage shortly after 10 p.m. following introductory remarks by state Rep. John Barrett III, D-North Adams, and Pittsfield Mayor Linda Tyer.

"I really want to thank the voters for their trust and their faith in me," said Harrington, who will become the county's first female district attorney. "I will work together with our elected officials here in Berkshire County to prevent crime, to bring public safety, to put dangerous people behind bars, but also to provide help for people who need it."

By 11:45 p.m., Harrington had gathered a substantial lead, and the votes had been counted in most of the county's largest communities.

Caccaviello arrived at Mazzeo's Ristorante just after 10 p.m. and thanked his supporters who were gathered there in hopes of a celebration.

Early in the night, the crowd, which included many law enforcement officials, cheered when the numbers appeared in his favor in some Pittsfield wards. 

As the night went on, however, the tone of the gathering soured. Several officials, including the Lee and Lenox police chiefs and former District Attorney David Capeless, declined to comment on their feelings about the results.

"Paul is undoubtedly the most qualified person for the position," former Pittsfield Mayor Daniel Bianchi said early in the night. "The implications of having someone in there with less qualifications is significant."

"Right now, I'm sharing some hugs and handshakes," Caccaviello said about his next steps. "We'll make more of a determination once everything is done and we'll figure out what's next."

He had not officially conceded the race as of press time.

"We didn't come this far to not make sure that everything is counted," he said of the results.

Harrington, 43, of Richmond, emerged victorious in the three-way Democratic primary in September, beating out incumbent Caccaviello by about 700 votes and earning her place on the Tuesday ballot. Caccaviello announced a write-in campaign about two weeks later.

Judith Knight, who polled third on the primary ballot with about 5,000 votes — or 24 percent — had since endorsed Caccaviello.

Caccaviello, 54, of Dalton, also set out to gather votes from Republicans who did not vote for him in the primary. State data show that there were about 7,700 registered Republicans in Berkshire County as of Oct. 17.

Harrington has run on a progressive platform, touting reform to the bail system and increased use of diversion programs for first-time offenders, addicts and those with mental illness. She won endorsements from leading Democrats near and far — including Mayor Tyer, Attorney General Maura Healey and Sen. Elizabeth Warren.

Caccaviello stopped short of endorsing progressive reform, asserting that each case should be handled individually. But after the endorsement from Knight, he signaled support for some progressive ideas that emerged during the election season. He also earned the support of state law enforcement organizations, including Sheriff Thomas Bowler and Berkshire County's chiefs of police. 

Caccaviello, a veteran of the Berkshire District Attorney's office for nearly 30 years, served as the first assistant under David F. Capeless for 14 years, until he retired in March. Gov. Charlie Baker appointed Caccaviello to succeed Capeless.

A native of Pittsfield, Caccaviello earned his law degree from Western New England Law School in 1989.

Harrington, a graduate of American University Washington College of Law, has been a criminal defense attorney for the past 15 years, including post-conviction work with individuals on death row in Florida, employment law, and appellate and defense work in Western Massachusetts district and juvenile courts.

In 2016, she ran an unsuccessful bid for the state Senate seat previously held by Benjamin B. Downing, but lost in the primary to current state Sen. Adam Hinds.

Jack Downing, executive director of Soldier On in Pittsfield, said he views Harrington as "a bright woman" and backed her candidacy Tuesday.

"She won the primary fair and square, and deserves our support," Downing said in an interview at the Berkshire Athenaeum's Ward 5 polls in Pittsfield. 

Erika Martin of Pittsfield also added her vote to Harrington's column.

"She's smart and good and a Democrat," Martin said, when asked how Harrington earned her backing. Virginia Donovan emerged from the basement polling station at the Berkshire Athenaeum to say she cast what she believes was her first write-in vote ever: for Caccaviello.

"He's been doing the job for a while, and doing a good job," Donovan said of the veteran prosecutor. Though Harrington campaigned as a reformer and was the only candidate actually listed on the ballot, Donovan said she believes Caccaviello has been implementing changes in the Berkshire District Attorney's Office, particularly in how he handles cases related to opioids.

John Betters, a pharmacist at Berkshire Medical Center, backed Caccaviello. He said he preferred Caccaviello's years of experience as a prosecutor. But he also was guided by his dislike of a national politician, Elizabeth Warren, who weighed in for Harrington.

So, in this case, he was asked, did Warren's endorsement help Harrington? "Just the opposite," Betters said.

The race between Harrington and Caccaviello grew more contentious as the general election approached. Harrington's campaign began comparing Caccaviello to President Donald Trump after he garnered endorsements from the county's Republican organization. 

In advertisements, Caccaviello's campaign, which upped its game dramatically post-primary, tried to poke holes in Harrington's resume and criticized her for garnering support from "political outsiders."

On social media, both candidates were subjected to vicious character assassinations from the supporters of their opponent.

At Harrington's party, supporters were elated. 

Jonathan Lothrop, former city councilor and field coordinator for Harrington, said the campaign had about 100 volunteers working the polls on Election Day. He said he put countless hours into Harrington's campaign because "what we're doing is fundamentally not working."

"We needed somebody who understands the change that we need, and also had the ability to inspire people," said Dina Guiel, volunteer coordinator for Harrington. "She is a leader."

After speeches were over, the disco lights came on and "Sweet Caroline" played over the speakers at Tavern at The A.

Put simply, Darcie Sosa said, "I believe in her."

The future seemed less certain to Caccaviello's supporters, but one of his longtime staffers said he at least knows what he's doing in the coming days.

"Tomorrow the men and women of the District Attorney's Office will report to work and do the job they've always done," said Fred Lantz, longtime spokesman for the Berkshire District Attorney's Office. "They will do the best for the people of Berkshire County to bring them justice."