Media playback is unsupported on your device Media caption Strauss-Kahn's lawyer said the idea of his client skipping bail was "ludicrous"

The former head of the International Monetary Fund (IMF) has been released from a New York City jail after posting $1m (£618,000) cash bail.

Dominique Strauss-Kahn, who denies charges of attempting to rape a hotel maid, is to be kept in home detention at a temporary location in Manhattan.

He had earlier agreed to be confined to a luxury flat but residents there refused to accept him, reports said.

He is to be kept under 24-hour guard and will wear a monitoring bracelet.

He was released into the custody of the security firm organising this, and will stay at a location run by the company, believed to be in the city's financial district.

The BBC's Laura Trevelyan says the judge approved this location temporarily - it is only suitable for a couple of days and then Mr Kahn must go somewhere else.

Mr Strauss-Kahn is charged with seven counts including four felony charges - two of criminal sexual acts, one of attempted rape and one of sexual abuse - plus three misdemeanour offences, including unlawful imprisonment.

His accuser is a 32-year-old originally from Guinea in west Africa who reportedly told authorities that Mr Strauss-Kahn had accosted her after she entered his hotel room to clean it.

Mr Strauss-Kahn, 62, denies the allegations and on 6 June is set to enter a formal plea.

He spent four nights at the notorious Rikers Island jail in New York City following his arrest on Saturday over the alleged incident at the Sofitel hotel.

Bail conditions Confined to New York apartment rented by wife

Security firm Stroz Friedberg to oversee monitoring

Monitored 24 hours a day, seven days a week

At least one armed guard at all times

Electronic monitoring

$1m bail, $5m insurance bond

His wife Anne Sinclair was said to have rented an apartment at the Bristol Plaza apartment building in New York, where her husband was to be confined under bail conditions set on Thursday.

New York media reported on Friday that Mr Kahn's release was delayed because residents of the building had complained about his plans to move there.

While Mr Strauss-Kahn had posted his bail, lawyers for the former IMF head said there were still other bail issues to be resolved, Reuters reported.

'Ludicrous'

Mr Strauss-Kahn was denied bail at a hearing on Monday, but on Thursday he went before a different judge.

The prosecution had argued that the defendant should be denied bail, as he had the means to live "a life of ease and comfort" in parts of the world "beyond this country's jurisdiction".

Defence lawyers said their client was honourable and would not try to abscond.

"The prospect of Mr Strauss-Kahn teleporting himself to France and living there as an accused sex offender, fugitive, is ludicrous," his lawyer, William Taylor, said.

New York Supreme Court Justice Michael Obus imposed $1m cash bail and said there must be 24-hour home detention, with an armed guard and electronic monitoring.

One armed guard must be deployed at all times, at Mr Strauss-Kahn's expense, and the defendant must surrender all travel documents, the judge added. In addition to the cash bail, a $5m insurance bond would also apply.

Mr Strauss-Kahn has now been formally charged following a grand jury hearing.

Late on Wednesday, Mr Strauss-Kahn announced his resignation from the IMF.

In a statement posted on the IMF website, he said he had resigned with "infinite sadness" but wanted to "devote all my strength, all my time, and all my energy to proving my innocence".

His resignation has sparked debate about his successor, with leading voices in Europe saying another European should head the fund. A number of figures have voiced support for French Finance Minister Christine Lagarde.