QUITO, Ecuador — Ecuador announced on Thursday that it had granted citizenship to Julian Assange, the WikiLeaks co-founder who has been living in a tiny room in the South American country’s London embassy since seeking political asylum in 2012.
It was an extraordinary development in the prolonged diplomatic standoff, and came only hours after Britain said it had rejected a request by Ecuador to grant Mr. Assange diplomatic immunity so he could leave the embassy.
“Ecuador knows that the way to resolve this issue is for Julian Assange to leave the embassy to face justice,” Britain’s Foreign Office said in a statement, adding that Britain was not in talks with Ecuador about the matter.
On Wednesday, Mr. Assange hinted that something was afoot when he tweeted a picture of himself wearing a yellow Ecuadorean soccer jersey.
Mr. Assange sought refuge in the embassy in June 2012 after Sweden sought to have him arrested in connection with allegations of rape and assault in that country. Sweden is no longer seeking his extradition, but Mr. Assange has refused to leave. He says he fears Britain would extradite him to the United States to face charges relating to his involvement in multiple releases of documents — including the 2010 publication of leaked State Department diplomatic cables — that American officials say have damaged national security.
Mr. Assange has managed to wear out his welcome over the years, alienating many of his previous supporters, including Edward J. Snowden, the former American intelligence contractor who leaked documents about surveillance programs.
He also offended potential supporters in the Democratic Party by allowing WikiLeaks to become the conduit for emails hacked by Russia from the Democratic National Committee and leaked to harm the presidential candidacy of Hillary Clinton.
American intelligence agencies have concluded that Russian hackers working for the Kremlin carried out the intrusions, but Mr. Assange insists he did not know the source of the emails, under the working rules of WikiLeaks. He has denied working for Russia or any other government.
The United States attorney general, Jeff Sessions, has said that arresting Mr. Assange isa priority. “We have professionals that have been in the security business of the United States for many years that are shocked by the number of leaks, and some of them are quite serious,” he said last year.
On Thursday, Steve Goldstein, the under secretary of state for public diplomacy and public affairs, said that “the decision to grant Julian Assange citizenship is a decision between Julian Assange and Ecuador.” He said the United States would “not discuss” whether it wanted to arrest Mr. Assange.
When Swedish prosecutors dropped their effort to have Mr. Assange extradited last year, they said it was not for reasons of guilt or innocence but because they saw no hope of compelling him to leave the embassy.
The British police say, however, say he is still subject to arrest on charges of jumping bail. And there is a strong possibility that the United States has issued a secret arrest and extradition warrant for Mr. Assange in connection with his assistance to Chelsea Manning, the Army private who was convicted of revealing state secrets.
Ecuador’s announcement came after several days of speculation that the Ecuadorean government was ramping up efforts to find a solution for Mr. Assange. The country’s foreign minister, María Fernanda Espinosa, said on Tuesday that it was looking for a third-party mediator who could broker a deal to allow Mr. Assange to leave the embassy.
“We’re considering, exploring the possibility of a mediation,” Ms. Espinosa said, according to Reuters. “No solution can be reached without international cooperation and without cooperation from the United Kingdom, which in addition has shown interest in finding a solution.”
On Wednesday, Mr. Assange posted the photograph of himself in the soccer jersey, and Reuters reported that his name had been recorded in a civil registry of Ecuadorean citizens.
On Thursday, Ms. Espinosa said that Mr. Assange had applied for citizenship on Sept. 16 and been granted it on Dec. 12. “What naturalization does is provide the asylum seeker another layer of protection,” she said. She said that Ecuador formally requested that Mr. Assange be given diplomatic status on Dec. 20 and that Britain rejected the request the following day.
Ms. Espinosa expressed irritation at recent news reports, saying she felt “obliged to make statements about a matter” that needed to “be managed with prudence and caution.” She said the decision to grant citizenship to Mr. Assange had been made after careful consideration of Ecuador’s obligations under its Constitution and under international law.
Ms. Espinosa also noted that the current government had inherited the problem from its predecessor. Rafael Correa, the president who decided to grant Mr. Assange asylum, was widely seen as wanting to burnish his credentials as a leftist leader who would not be cowed by the United States. But he found Mr. Assange to be a headache as well: In October 2016, Ecuador temporarily suspended Mr. Assange’s internet access after WikiLeaks published documents from Mrs. Clinton’s presidential campaign.
Mr. Correa left office in May after a decade as president. He was succeeded by Lenín Moreno, who although an ally of Mr. Correa’s has demonstrated little enthusiasm for Mr. Assange’s cause. He has called Mr. Assange a hacker, and warned him not to meddle in politics.
On Thursday, Ms. Espinosa said Ecuador was exploring a variety of possible resolutions to the dispute. She mentioned “dialogue with the United Kingdom” and mediation by other states or international organizations that could “facilitate a just, lasting and dignified resolution for all the involved parties.”
She said that Ecuador had “the best relations of friendship and cooperation” with Britain.
In a separate statement, the ministry said Mr. Assange had “committed to not intervening in affairs outside the scope of his asylum status,” which seemed an oblique reference to his penchant for creating a stir.
Greg Barns, a lawyer who advises Mr. Assange and WikiLeaks, said in a telephone interview from New Zealand that the situation was “intolerable” for his client and for Ecuador.
The embassy is in the affluent Knightsbridge section of London, but he said Mr. Assange had been effectively “imprisoned with no access to natural light and fresh air for a period of five and a half years.”
In 2015, the London police ceased round-the-clock surveillance of the embassy, citing the cost, but warned that Mr. Assange would still be arrested if he left. In 2016, United Nations experts concluded that Mr. Assange had been arbitrarily detained in violation of international law. But Britain and Sweden argue that by choosing to jump bail and seek asylum in the Ecuadorean embassy, Mr. Assange has effectively imprisoned himself.
Mr. Barns suggested that the Australian government would be an obvious third-party mediator, given that Mr. Assange is a citizen of Australia, which has excellent relations with Britain.
Ricardo Patiño, who was foreign minister of Ecuador under Mr. Correa and has described Mr. Assange as the victim of persecution, said he hoped that Britain would relent and allow a mediator — like a country or even a distinguished individual — to try to facilitate Mr. Assange’s departure from the embassy.
Another former foreign minister, José Ayala-Lasso, who also has served as the United Nations high commissioner for human rights, said that diplomatic immunity would have been an elegant solution to the problem because it would have exempted Mr. Assange from facing punishment in Britain for bail jumping.
But since Britain has rejected that option, Mr. Ayala-Lasso said, it is difficult to see how mediation would work. “This is a conflict that is judicial-political in nature,” he said, “and Britain will not cede its position.”
Joaquín Hernández, an Ecuadorean scholar of international relations, said the problem was one of Ecuador’s own making.
“Ecuador never should have accepted Assange as a refugee because of his questionable reputation, but it was done anyway in search of international attention,” he said in an interview.