London (CNN) -- WikiLeaks founder Julian Assange was granted bail Tuesday after a hearing at Westminster Magistrate's Court in London, but a lawyer representing Swedish prosecutors immediately filed an appeal.

That means Assange will remain in jail until the next hearing, which should be before the High Court within 48 hours, lawyers said.

The 39-year-old Australian handed himself over to London police last week to answer a European arrest warrant over alleged sex crimes in Sweden.

Assange is facing accusations of rape, sexual molestation and illegal use of force in separate incidents in August in Stockholm. He could be sentenced to two years in prison if convicted. His lawyers deny the allegations and have vowed to fight any attempts at extradition.

The magistrate agreed to grant bail Tuesday after Vaughan Smith, a former British army officer who founded London's Frontline Club, testified that Assange could stay at his mansion in Suffolk.

Smith will keep Assange "if not under house arrest, at least under mansion arrest," said defense attorney Geoffrey Robertson. At that, Assange, dressed in a white shirt and a blue jacket and sitting in a glassed-in corner of the court with three security guards, smiled wryly.

The magistrate set bail at 200,000 pounds (about $315,000) plus two sureties of 20,000 pounds each (about $31,500). Assange's passport must remain with police, and he will be monitored by a location tag.

Assange must be at Smith's mansion, about two hours outside of London, for at least four hours overnight and four hours during the day. He will be required to report to police daily between 6 and 8 p.m. The next court hearing was scheduled for January 11.

After the conditions were set, Assange stood and said, "I understand," with a neutral expression.

His mother Christine told reporters after the hearing that she was "very, very happy" and thanked "the media for all your support of my son."

But several hours later, Sweden filed its appeal.

Outside the court, about 100 people demonstrated in support of Assange, holding signs saying "Julian Assange is a political prisoner" and "Why are you shooting the messenger?" and "This is not 1984."

During the hearing, Assange's team of attorneys argued that since he is only wanted for questioning and has not been formally charged, he is presumed innocent. The magistrate agreed.

But, said Gemma Lindfield, the attorney representing the Swedish prosecution, "The court has already found that Mr. Assange is a flight risk. Nothing has changed in this regard."

She said if the alleged offenses had occurred in Britain, "it undoubtedly would have been a charge of rape in this jurisdiction."

Robertson disputed that.

Celebrity supporters of Assange at the hearing included Bianca Jagger, who sat next to Fatima Bhutto, niece of the late Pakistani politician Benazir Bhutto and current Pakistani President Asif Ali Zardari, and prominent left-wing journalist John Pilger.

Socialite Jemima Khan came to court but it is not clear she got into the very crowded hearing room. Many were turned away for lack of space.

Judge Howard Riddle denied Assange's first request for bail at a hearing on December 7 on the grounds that there was a risk he would fail to surrender.

On Tuesday, he cited four reasons for his insistence a week earlier on keeping Assange in jail: his lack of fixed residence, confusion over when and how he last entered the United Kingdom, the evidence against him in Sweden, and a dispute over whether Assange is wanted only for questioning or for prosecution.

Smith's offer of his mansion satisfied Riddle on the question of an address, and testimony from someone who arrived in the U.K. with Assange from Switzerland answered that question, he said.

He said he was not taking a position on the Swedish evidence against Assange, and that a future hearing would have to determine whether Assange was wanted for questioning or prosecution.

WikiLeaks' release of thousands of secret U.S. diplomatic and military documents is under criminal review in the United States.

Almost half of Britons believe that the sex charges against Assange are "an excuse" to keep him in custody so that the U.S. government can prosecute him for releasing secret diplomatic cables, a new poll for CNN shows.

The ComRes poll of British opinion, released Monday on the eve of Assange's bail hearing, finds that 44% of respondents in Great Britain believe that Sweden's sex charges are just a pretext, while only 13% flatly disagree.

The remaining 43% say they don't know.

Last week, U.S. Attorney General Eric Holder said he had authorized "significant" actions related to a criminal investigation into WikiLeaks' publication of the materials but has declined to elaborate.

WikiLeaks inflamed U.S. authorities last month by publishing the first of a large group of confidential U.S. diplomatic cables.

Only a small fraction of the 250,000 U.S. State Department documents have been released and more are being published daily.

U.S. authorities and other Western leaders say the documents' publication threatens lives and national security.

WikiLeaks and its supporters say that the public has a right to know what is going on behind diplomatic doors.

CNN's Richard Allen Greene, Atika Shubert and Hilary Whiteman contributed to this report.