A judge on Thursday granted $1 million bail to Dominique Strauss-Kahn, releasing the former chief of the International Monetary Fund from jail but ordering him to be kept under home detention on charges that he sexually assaulted a hotel maid last weekend in New York.

In granting bail, New York Supreme Court Judge Michael J. Obus set stringent conditions: an additional bond of $5 million secured by Strauss-Kahn’s home or other assets, the surrendering of all travel documents and home detention including an electronic monitoring device and at least one guard present at all times.

Obus acknowledged that there is “a serious risk” that Strauss-Kahn could attempt to flee and that if he made it out of the country, “it might be impossible to get him back.”

The security arrangement, estimated by prosecutors to cost as much as $200,000 a month, would be paid for by Strauss-Kahn, who resigned his post as IMF managing director on Wednesday. Defense attorneys said the security company Stroz Friedberg would be responsible for the monitoring setup.

“I expect that you will be here” for court, Obus said, addressing Strauss-Kahn directly. “I do want to make it very clear: If there is the slightest problem with your compliance,” court officials would quickly alter the bail agreement.”

Earlier in the day, a grand jury indicted Strauss-Kahn on all seven charges he faced after his arrest on May 16, including four felony counts and three misdemeanors.

“These are extremely serious charges, based on the grand jury’s determination that the evidence supports the commission of non-consensual, forced sexual acts,” Manhattan district attorney Cyrus R. Vance Jr. said after the bail hearing.

Prosecutors said Strauss-Kahn was indicted on two counts of first-degree criminal sexual act, one count of attempted rape in the first degree, one count of sexual abuse in the first degree, one count of unlawful imprisonment in the second degree, one count of forcible touching and one count of sexual abuse in the third degree.

According to the documents filed in court, Strauss-Kahn, 62, trapped the 32-year-old maid in his hotel room on May 14 by shutting the door behind her. He then sexually assaulted her, prosecutors said.

After the bail hearing, Vance emerged from the criminal courthouse to face the sea of flashing cameras, television crews and shouting reporters. Some cameramen climbed step ladders to capture the chaos from a better vantage point. Vance stood at a bank of microphones, speaking about Strauss-Kahn’s indictment. An inscription carved in stone on the wall just behind him read: “Only the just man enjoys peace of mind.”

Obus set a formal arraignment for Strauss-Kahn for June 6 at 9:30 a.m.

Strauss-Kahn will now be able to leave Rikers Island jail, where he has been staying since a judge ordered him held without bail earlier this week.

The former IMF chief arrived in court just after 2:30 p.m. Thursday, wearing a gray suit and a blue shirt with no tie. He was clean-shaven and looked more rested than when he first appeared in court earlier this week. He smiled at his wife and daughter, who were sitting in the front row, and took his place beside William Taylor, his Washington-based attorney, and the rest of his legal team at the defendant’s table. He was surrounded by five law enforcement officers. His expression became steely as he listened to the proceedings.

In arguing for Strauss-Kahn’s release, Taylor told Judge Michael J. Obus that Strauss-Kahn’s wife, TV and radio personality Anne Sinclair, had rented an apartment in Manhattan where she intended to live with him while he fights the assault charges. Taylor said Strauss-Kahn would be willing to submit to the “most restricted possible conditions”: He would be fitted with an electronic monitoring device; cameras would monitor the entrances and exits of his building; and guards with a private security firm would ensure that he did not leave the premises.

“We might as well just go to the nub of the matter,” Taylor said, adding that he thought bail was unnecessary for his client. “He is an honorable man … He has only one interest at this time, and that is to clear his name.”

Taylor also sought to dispel parts of the narrative about the incident that led to Strauss-Kahn’s arrest. He submitted Strauss-Kahn’s itinerary for the trip to Europe that he was due to take when he was arrested on a plane at John F. Kennedy airport on Saturday. The documents showed that Strauss-Kahn had purchased his Air France flight on May 11, days before departure.

“These two pieces of evidence authoritatively rebut the notion that Mr. Strauss-Kahn was in a panic mode,” Taylor said, adding that the IMF chief also had enjoyed “a leisurely lunch” with a family member in midtown Manhattan before heading to the airport.

Taylor said that Strauss-Kahn has a net worth of about $2 million, including a U.S. bank account in the “low seven figures.” He and his wife also own a $4 million home in Georgetown, though property documents show it is listed in Sinclair’s her name.

Assistant district attorney John McConnell immediately rejected the arguments for Strauss-Khan’s release, saying that the seriousness of the charges, as well as his international contacts and personal wealth, make him a persistent flight risk.

McConnell also noted that France does not extradite its foreign nationals and that if Strauss-Kahn were able to make it to his homeland, he could “lead a life of ease and comfort.”

“There is no bail package … that would ensure his return,” McConnell said, adding that prosecutors hadn’t had sufficient time to review the conditions proposed by Strauss-Kahn’s attorneys.

Before the hearing, an army of television trucks sat parked outside the courthouse at 100 Centre St. in Lower Manhattan as members of the media waited hear whether Strauss-Kahn would be given bail.

TV reporters stood under small tents, offering one live update after another hours in advance of the hearing. Inside on the 13th floor, a mixture of French and English echoed off the dingy courthouse walls, as reporters from around the globe had lined up hours early to snag a seat in Part 51, Room 1324.

Shawn Naunton, another of Strauss-Kahn’s attorneys, had filed a petition bail earlier. The document proposed the home detention and portrayed Strauss-Kahn as “a highly-regarded diplomat, lawyer, politician, economist and professor, with no criminal record.”

The document noted that Sinclair had been born in New York and that one of Strauss-Kahn’s daughters, Camille Strauss-Kahn, is a Columbia University graduate student who “lives permanently” on the Upper West Side of Manhattan.