Bob Filner was elected mayor of San Diego in 2012. / Bill Wechter, Getty Images

by Catalina Camia and Michael Winter, USA TODAY

by Catalina Camia and Michael Winter, USA TODAY

The San Diego City Council accepted Mayor Bob Filner's resignation Friday afternoon, ending weeks of turmoil over his alleged sexual harassment of several women. He will leave office Aug. 30 at 5 p.m.

The council announced that it had voted, 7-0, in closed session to accept the resignation, which includes settlement of a lawsuit filed by one of his former top aides.

Moments after Filner spoke, the California attorney general's office confirmed that it is conducting a criminal investigation of his actions, assisted by the San Diego County Sheriff's Department, the Associated Press reported.

In his speech, Filner apologized for "letting the city down," saying, "My own personal failings were responsible."

He also "sincerely apologized" to "all the women I offended," telling them, "I had no intention to be offensive, to violate any physical or emotional space.

"I was trying to establish personal relationships but the combination of awkwardness and hubris led to behavior that I think many found offensive," he said.

At least 17 women have accused him of sexual harassment and inappropriate behavior, including groping, unwanted kissing and suggestive comments. .

But the 70-year-old Filner remained defiant. "I've never sexually harassed anyone," Filner said, blaming a "lynch mob" -- the media and political opponents -- for his departure. He argued he "would be vindicated" if he had been given "due process."

Shortly after Filner spoke,

The council heard from angry citizens and Filner supporters before going into a scheduled closed session to vote on the agreement. The deal was reached this week after mediation sessions involving Filner, his lawyers, city representatives and attorney Gloria Allred, the lawyer for Irene McCormack Jackson, the mayor's ex-communication director.

Two people briefed on the deal told the Associated Press that the mayor would resign and the city would pay legal fees in the lawsuit. One person told the AP that the city would pay for any potential damages incurred by Filner in McCormack Jackson's lawsuit. The sources spoke on condition of anonymity before terms of the agreement were made public.

Filner's departure bring an end to weeks of turmoil that have engulfed San Diego, nicknamed "America's Finest City."

"This has been one of the most difficult and trying periods in our city's history. It's now time for us to come together, heal our city, and move San Diego forward," Councilman Kevin Faulconer said, adding that the agreement "protects taxpayers and closes this sad chapter in San Diego's history."

Earlier in the day, City Attorney Jan Goldsmith said the city needs to "begin to heal."

"We look at stability as the mayor resigning and a special election, that's what we're facing," Goldsmith told AP. "That's stability for San Diego right now. If that happens, then we're on our way to stability. ... We cannot have six months to a year more of this issue."

Filner is the fourth San Diego mayor since the 1980s to resign before his term ended.

Filner was elected last year after serving 10 terms in Congress. He is the first Democrat elected to lead the nation's eighth-largest city in 20 years.

His public-service career spanned three decades, including stints on the San Diego school board and City Council. Filner also taught at San Diego State University for two decades. He was a Freedom Rider during the civil rights movement, and was jailed for two months in 1961 in Mississippi after being arrested for disturbing the peace and inciting a riot.

Filner is eligible for a federal pension of about $59,000 a year because of his congressional service, according to calculations by Pete Sepp of the National Taxpayers Union for USA TODAY.

Filner could receive combined pension of about $82,000 a year when the pensions from his previous City Council stint and state university work are included, the ABC News affiliate in San Diego reported.

When Filner's resignation takes effect, City Council President Todd Gloria, a Democrat, will become acting mayor until a special election is held within 90 days.