Republican Carl DeMaio on Sunday conceded defeat to incumbent Scott Peters in one of the nation's most hotly contested congressional races to represent a large part of San Diego, ending a bitter campaign that was rocked by claims that he sexually harassed a former staffer.

DeMaio, who is openly gay, said he will work within his party to make it more inclusive, echoing a theme of his campaign. He was not more specific about his plans but said the campaign was "incredibly painful" and left him wary about electoral politics.

"It's clear that we are falling short in the vote counts and I wish Mr. Peters the best because I care so much about the interests of San Diego," he told The Associated Press. "I'm incredibly proud of the inclusive and diverse campaign coalition that we forged and I remain committed to challenging the Republican Party to become more inclusive and more positive in its efforts to build a governing majority."

Peters, a moderate Democrat, leads with 51.3 percent of the vote compared DeMaio's 48.7 percent, with nearly all votes counted. The Associated Press called the race for Peters, 56, on Friday.

DeMaio's campaign was upended in its final weeks when Todd Bosnich, former policy director, said he was harassed by his former boss and offered $50,000 to stay quiet. DeMaio vigorously denied the allegations and called them a "false smear."

Dave McCulloch, a spokesman, said the controversy created "massive attrition and erosion" among DeMaio's Republican base — including older, evangelical Christian voters — and created "an ick factor." The allegations were less of an issue with independent voters, he said.

The latest headlines on the 2016 elections from the biggest name in politics. See Latest Coverage →

DeMaio, 40, sharply criticized Peters over the extent to which his campaign communicated with Bosnich, as disclosed in search warrant affidavits that were unsealed Friday. U-T San Diego and KNSD-TV reported on the disclosures.

Peters' campaign manager MaryAnne Pintar, informed police of the allegations against DeMaio, U-T San Diego reported, a role that was never acknowledged during the campaign. The documents reveal that Pintar met with Bosnich at a coffee shop, took delivery of DeMaio campaign materials, and kept possession of them for some time — counter to Peters' statement during a televised debate that they were handed over to police immediately.

"Given the evidence that is emerging and is likely to emerge in coming weeks and days, Mr. Peters has significant, serious questions that he must answer," DeMaio said.

Pintar defended her actions on Sunday.

"A young man came to me saying he had been sexually assaulted and threatened by Carl DeMaio. I took that information to the police and they thanked me for doing the right thing," she told the AP.

Peters told KPBS-FM he "messed up the timeline" during the debate and acknowledged the materials "did sit in an envelope for a little while before the police came to pick it up."

However, he insisted he never looked at the materials.

The material, which DeMaio's campaign said was stolen in a burglary of his office that left computer screens smashed and phone lines cut, was highly sensitive, McCulloch said. It included schedules, about 50 mailers and when and how the campaign planned to go negative on Peters.

San Diego County District Attorney Bonnie Dumanis said little more than two weeks before the election that there was insufficient evidence to file criminal charges against DeMaio for harassment or Bosnich for the burglary, but controversy surrounding DeMaio fueled news coverage. As DeMaio sought to bring attention to issues ranging from veterans benefits to border security, he was repeatedly confronted with the allegations.

DeMaio, who is in a committed relationship with publisher Johnathan Hale, said the allegations "were incredibly painful to me and my family. And given that, all, including myself, must be wary of the state of journalism today and where electoral politics are heading."

California's 52nd congressional district spans much of San Diego's coast and includes the suburbs of Poway and Coronado.