LONDON — WikiLeaks founder Julian Assange was granted asylum on Thursday by Ecuador, raising the possibility of a diplomatic showdown between British and Ecuadoran authorities.

The transparency campaigner has been holed up at the Embassy of Ecuador in London for nearly eight weeks after seeking refuge there in a bid to avoid extradition to Sweden, where he is wanted for questioning over alleged sex crimes.

The British Foreign Office made it clear Thursday that Ecuador’s decision does not alter Britain’s intention of fulfilling its legal obligation to extradite Assange. “We shall carry out that obligation,” it said in a statement. “The Ecuadorian government’s decision this afternoon does not change that.”

At a news conference in Quito, Ecuador’s foreign minister, Ricardo Patino, said Ecuador had decided to grant asylum “because of the fears expressed by Mr. Assange, we believe that his fears are legitimate, and there are threats that he could face political persecution if the measures aren’t taken to avoid them.”

Patino said Ecuador failed to get guarantees from Britain, Sweden and the United States that Assange would not be extradited from Sweden to the United States. His supporters believe he could be tried for espionage in the United States over his whistle-blowing Web site’s release of hundreds of thousands of confidential military logs and diplomatic cables.

Firing off tweets, the British Foreign Office said it was “disappointed” with the decision. “Under our law, with Mr Assange having exhausted all options of appeal UK authorities are under binding obligation to extradite him to Sweden,” it said.

It’s not clear what’s next for Assange, who faces arrest the minute he steps foot out of the Ecuadoran Embassy for breaching one of the conditions of his bail, namely to check in at a designated address between 10 p.m. and 8 a.m.

“It’s hard to see how practically he gets out of the country. The British won’t acknowledge his asylum and aren’t required to,” said Julian Knowles, an expert in extradition law.

Ratcheting up diplomatic tensions further, Ecuadoran officials revealed Wednesday night that they had received a written warning from Britain saying that British police could enter the Ecuadoran Embassy to arrest Assange under the Diplomatic and Consular Premises Act, a little-known piece of legislation passed in 1987.

Initially, when Assange fled to the embassy June 19, the British government said he was beyond the reach of law enforcement officials. But Patino said Wednesday that British authorities informed them they could “storm” the embassy if Assange was not handed over.

The Associated Press said that the Swedish Foreign Ministry called in the Ecuadoran ambassador to complain about the decision. AP reported that Swedish Foreign Minister Carl Bildt said in a Twitter message, “Our firm legal and constitutional system guarantees the rights of each and every one. We firmly reject any accusations to the contrary.”

It was clear in Patino’s lengthy statement Thursday that the political temperature between Ecuador and Britain has risen sharply, with Ecuador feeling bullied by “colonial” Britain.

In June, Assange exhausted all of his legal options in Britain when the country’s Supreme Court upheld Sweden’s extradition request, ending a marathon legal battle that began after his arrest in December 2010.

Swedish authorities want to question Assange over allegations of sexual abuse involving two women he met in separate encounters during a trip to Stockholm in August 2010. The 41-year-old Australian strenuously denies the allegations, admitting he had brief affairs with the women but insisting the sex was consensual.

Karla Adam is a London correspondent for The Washington Post. Before joining The Post in 2006, she worked as a freelancer in London for the New York Times and People magazine.