Outspent by a wide margin, Cumberland County Sheriff Kevin Joyce attributed his successful bid for a second term to the slow, quiet business of building relationships in the community, away from the glare of competitive politics.

Spending nights after work at community meetings, speaking with constituents and sitting on boards and commissions, Joyce said he has tried to work his way into the fabric of Cumberland County, earning him the name recognition that is invaluable in local elections.

“I vowed when I got elected four years ago that the first day (in office) would be the first day of a big campaign for the following election,” said Joyce, who spoke Wednesday about his strategy going into Tuesday’s primary. To his staff, he preaches a bedrock business principle: “Customer service,” said Joyce.

Inmates and suspects are not traditional customers, but their experience dealing with the sheriff’s department staff contributes to a reputation that matters at the ballot box, he said.

Once the votes were counted Wednesday in the Democratic primary, Joyce had beaten his opponent, retired State Police Sgt. Michael Edes, 9,669 to 6,731, or 59 percent to 41 percent, with voter turnout of roughly 21 percent.

Joyce will have no Republican opponent on the ballot in November.

Edes, who conceded the race late Tuesday, did not respond to calls for comment Wednesday.

Edes raised $37,000, giving him the financial advantage over Joyce, who raised less than $14,000 – $2,000 of which Joyce personally loaned his campaign to pay for a last-minute radio advertisement, according to campaign disclosure documents.

Joyce’s lean campaign relied on volunteers and judicious spending, said his campaign manager, Dennis Hersom, himself an unpaid volunteer who nonetheless brought specialized political experience to the campaign. During more than 25 years as a volunteer campaign manager, Hersom has helped Joyce and his two predecessors – Mark Dion, now a state representative, and Wesley Ridlon – win seven straight elections, Hersom said.

Hersom said that Edes’s campaign disclosures listed many purchases of gas for travel and dinner and lunch tabs for wooing donors, as well as to pay Portland attorney Paul J. Brunetti $5,000 for general consulting, planning and public relations work.

“I’ve said all along, Mike Edes ran a campaign pretty much by the book with that kind of money,” Hersom said. “With Kevin (Joyce), we made sure that he did the right things throughout the community to build name recognition.”

What surprised many, including Hersom, was a political action committee’s $100,000 campaign to defeat Joyce. Citizens for a Safe Cumberland County, backed by Michael Liberty, a childhood friend of Edes and former Maine real estate developer, attacked Joyce’s record as overseer of the county jail, specifically two incidents in the past two years in which inmates – one male and one female – escaped their cells and made their way to other parts of the jail where they had sexual encounters with other prisoners.

The PAC’s ads, which played up the sexual aspect of the incidents, ran for weeks on the radio and in direct mailers. Edes said he and his campaign did not coordinate efforts with Liberty’s PAC, which would have violated federal election law.

Liberty did not respond to a request for comment Wednesday.

A few voters interviewed Tuesday said the PAC contributions was a negative for them, but it’s unclear how big a role the ads may have played in the election.

The introduction of unlimited spending by political action committees, as a result of the U.S. Supreme Court’s landmark 2010 Citizens United ruling, goes against the ethos of Maine voters, said University of Southern Maine political science professor Ronald Schmidt Jr.

“Mainers are having to adjust to an awful lot of spending and an awful lot of advertising,” Schmidt said.

Hersom said that despite the big money spent against them, the backlash from the negative ads ended up driving people to the polls, helping Joyce add a few percentage points.

“I’m not going to give the race away to the PAC,” he said. “Kevin won that race.”