After nearly seven years essentially trapped inside Ecuador's embassy in London, WikiLeaks founder Julian Assange had become an expensive bother to his hosts – they wanted him out.

"They were over him, he was a big nuisance," one senior U.S. official told ABC News. "They were saying ‘This is too much. How do we get him out?’"

But revoking his diplomatic asylum at a time when he was wanted by the United States for his alleged role in hacking and publicizing some of the nation’s most sensitive government secrets would come only after covert, back-channel negotiations, ABC News has learned.

(MORE: WikiLeaks founder Julian Assange arrested after 7 years of hiding out; indicted in US)
Julian Assange gestures as he arrives at Westminster Magistrates' Court in London, after the WikiLeaks founder was arrested by officers from the Metropolitan Police, April 11, 2019.(Victoria Jones/PA via AP) Julian Assange gestures as he arrives at Westminster Magistrates' Court in London, after the WikiLeaks founder was arrested by officers from the Metropolitan Police, April 11, 2019.

The process of moving Assange out of the Ecuadorian Embassy started a year ago, on March 7, 2018, when the Ecuadorians made their first request to the U.K.: a letter asking for written assurances that the U.K. would not extradite Assange to a country where he could face the death penalty, according to the Ecuadorian Interior Minister Maria Paula Romo.

Ecuador's direct outreach to the U.S. came six months later, through the country’s ambassador to Germany, Manuel Mejia Dalmau, according to U.S. and Ecuadorian officials. Dalmau sought a private "emergency meeting" in Berlin with the U.S. Ambassador to Germany, Richard Grenell, viewed as one of President Donald Trump’s closest envoys in Europe, the officials said.

At the time, Dalmau said Ecuador was spending between $30,000 and $35,000 per month to house Assange because of his need for extra security and his demands for extra space within the embassy, according to a senior U.S. official, who was not authorized to discuss the issue on the record.

The Latin American country said it has spent $10 million on Assange, including medical expenses, legal counsel, food and laundry since 2012 when Assange first sought asylum from Sweden where he was the subject of a rape investigation – an inquiry he has claimed was politically motivated. Prosecutors in Sweden on Thursday announced they intended to re-open the investigation.

Assange’s presence was also creating a squeeze on the Ecuador’s London facilities, forcing officials there to rent additional offices for an expanding diplomatic staff because Assange took up so much space.

The Department of Justice stands in the early hours of March 22, 2019 in Washington, D.C.(Drew Angerer/Getty Images, FILE) The Department of Justice stands in the early hours of March 22, 2019 in Washington, D.C.

The challenge the Ecuadorans faced in turning him over to British officials, though, was the prospect of Assange facing the death penalty, which Ecuador strongly opposes. Dalmau was blunt in his request, according to U.S. and Ecuadorian officials.

During one meeting, Dalmau asked whether the U.S. would commit to not putting Assange to death, according to a senior US. official.

Grenell then contacted the U.S Justice Department to see if he could provide assurances that the U.S. government would not seek the death penalty. According to the senior U.S. official, Deputy Attorney General Rod Rosenstein consented. That enabled Grenell to make the pledge. The agreement between the U.S. and Ecuador was a verbal one, according to a source in the Ecuadoran government.

The State Department declined to comment on this story.

U.S. Justice Department officials would not confirm that the U.S. agreed to take any sentence off the table. But they pointedly noted that the charge the U.S unsealed against Assange does not represent a capital offense and carries a maximum of five years in prison.

The Justice Department has 60 days from the time of the request for extradition to add any charges and would not comment on future charges.

There are only 41 U.S. federal offenses punishable by the death penalty. Nearly all of them have to do with murder or death resulting from some other crime or action. Two notable exceptions are treason and espionage. It is unclear if the U.S. ever contemplated an espionage charge, or if one would have been applicable for the conduct described in the indictment filed under seal in March 2018 in the Eastern District of Virginia. The indictment alleges that Assange in 2010 “agreed to assist Manning in cracking a password stored on United States Department of Defense computers connected to the Secret Internet Protocol Network, a United States government network used for classified documents and communications.”

These government materials included diplomatic cables and disturbing videos of U.S. military forces in Iraq.