His departure follows a deal with the Californian city's council over legal fees for the lawsuit he faces.

City Council President Todd Gloria will now become acting mayor and a special election will be held in 90 days.

"The city should not have to go through this, and my own personal failures were responsible and I apologise to the city," the 70-year-old Mr Filner told a special meeting of the San Diego city council on Friday.

"To all the women that I've offended, I had no intention to be offensive, to violate any physical or emotional space," he added.

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

'Lynch mob hysteria'

But he struck a defiant tone as he added: "Not one of the allegations has ever been independently verified or proven in court.

"I've never sexually harassed anyone."

He said he had been the victim of "the hysteria of a lynch mob".

Under Mr Filner's resignation deal, the city will pay his legal fees in a joint defence of a lawsuit filed by the mayor's former communications director, said City Attorney Jan Goldsmith.

Bob Filner has his supporters and detractors (two of whom are shown here)

It will also pay for any settlement costs against the mayor except for punitive damages. The city would also pay up to $98,000 (£63,000) if Mr Filner wants to appoint his own lawyer.

He also faces a criminal investigation, the California attorney general's office said on Friday.

Mr Filner's former spokesman, Irene McCormack Jackson, was the first to accuse him publicly of inappropriate behaviour. She launched a lawsuit last month against him and the city.

She alleged that the mayor had asked her to work without underwear, demanded kisses and told her he wanted to see her naked.

Her lawyer, Gloria Allred, told reporters: "It is not appropriate for the city of San Diego to provide a gift of public funds to a sexual harasser to help him fight the victim of the lawsuit we filed."

She also said she strongly supported the mayor's resignation.

Since the lawsuit, a series of women, including high-profile city residents and a great-grandmother, have come forward with accusations against Mr Filner.

Veronica Froman, a retired rear admiral, said Mr Filner once blocked her from leaving a room, ran his finger up her cheek and asked if she had a man in her life.

The president of the city port tenants' association, Sharon Bernie-Cloward, said Mr Filner had groped her on her bottom at an event last year.

"I was left there startled and fearful," she was quoted as saying by US media. "I actually had someone walk me to my car that night."

Other alleged victims included several businesswomen, a college dean and two military veterans who said he harassed them as they attended a meeting for women who had been raped while serving in the armed forces.