A Spanish mayor has apologised after an outcry over his comments that lone women in lifts could rip off their bras and skirts to make false accusations of assault.

"I have qualms about getting into an elevator," the conservative mayor of Valladolid in central Spain, Francisco Javier León de la Riva, told Spanish radio on Thursday.

"Imagine you get into an elevator and there is a girl who is out to get you, she enters with you, tears off her bra or skirt and flees shouting that you have tried to assault her," he said. "Beware of this kind of thing."

Faced with a public backlash, the mayor offered an apology. "I am sorry that statements taken out of context have had such repercussions," he told Spanish journalists on Friday.

"To anyone who was offended, I have no problem offering an apology."

Women's groups and politicians had reacted with outrage to the mayor's comments. "We should not and will not tolerate the mayor seeking publicity at the price of women's pain," said an association for victims of sexual assault and abuse, Adavasymt.

"We demand the immediate resignation of the mayor of Valladolid," it said in a statement.

The opposition Socialist party's secretary for equality, Carmen Montón, accused the mayor of trivialising rape and feeding the spectre of false rape allegations. Only 0.01% of complaints of violence against women were false, she said.

The mayor's comments coincided with a row over government advice to women about how to avoid rape. The list of tips on the interior ministry's website tells women not to walk alone on isolated roads, "especially at night", to buy a whistle, and to avoid entering an elevator occupied by a stranger.

Women living alone are urged to close their curtains at night to avoid prying eyes.

"It is a way of instilling fear, of blaming women and shirking responsibility," Montón said on Twitter.

Her fellow Socialist party official Susana Sumelzo said: "Reality is stranger than fiction: the interior ministry says we should close our curtains to avoid rape."

The interior ministry has since asked police to update the advice to conform with "current times", a ministry spokesman said, adding that the list had been on the site for at least 10 years.