After a six-year behind-the-scenes diplomatic entanglement between Madrid and Washington, the US government has agreed to allow a convicted Spanish drug trafficker to serve the remainder of his prison sentence in Spain.

David Mendoza Herrarte, who is being held in a New Jersey prison, was granted a prisoner transfer request, according to court papers filed Thursday in a US federal court.

The announcement came just days after the Spanish Supreme Court called on the government of Prime Minister Mariano Rajoy to intensify its pressure on Washington to allow Mendoza to serve out his term close to his family in the Basque Country.

Spain’s Supreme Court called on Rajoy to intensify its pressure on Washington in the Mendoza case

The Mendoza case is just one of many extradition and prisoner-transfer disputes that has Madrid and Washington at loggerheads.

Mendoza, 51, claimed that the US prosecutors reneged on their original deal to allow him to serve his sentence in Spain if he waived extradition and pleaded guilty following his June 5, 2008 arrest in Gernika on US drug charges. He filed complaints in both the Spanish and US courts after his transfer was denied.

After he was sent back, the United States maintained there was no such agreement but instead a verbal pledge that prosecutors would do what they could to recommend a prisoner transfer.

Mendoza was a businessman who owned a building firm called ETA Construction and a Seattle pizzeria

Born in Los Angeles to Spanish parents, he traveled to the Basque Country and acquired Spanish citizenship before he was indicted in Seattle in 2007 for importing large shipments of marijuana from Canada. Sentenced to 14 years in prison, Mendoza was a businessman who owned a building firm called ETA Construction and a Seattle pizzeria, Pazzo's.

Before his arrest, he reportedly spent his time traveling back and forth to Spain. But US prosecutors argued that he applied for Spanish nationality to avoid extradition.

In December, Spain’s top court upheld High Court Judge Javier Gómez Bermudez’s 2011 order for the Popular Party (PP) government to ensure that that the United States keep its side of a bargain that led to Mendoza’s extradition in 2009. It based its ruling on the Council of Europe’s Convention on the Transfer of Sentenced Prisoners.

On March 18, the Supreme Court justices again called on the Rajoy government “to adopt all the necessary measures” to bring Mendoza to Spain.

At least on two occasions, Spain raised the issue in diplomatic notes sent to the US Embassy on December 16, 2011 and February 7, 2012. The Spanish Ambassador in Washington, Ramón Gil Casares, also met with the US attorney general’s assistant on international affairs to express his government’s “concerns” about the delay in Mendoza’s transfer, Europa Press reported.

Mendoza’s case was also taken up by opposition parties, including Union, Progressive and Democracy (UPyD) and the Canaries Coalition (CC), which both asked in Congress why the PP government wasn’t doing enough to win Mendoza’s transfer.

But it appears that the final chapter came last Thursday in a US District Court in the state of Washington, where Mendoza filed a civil lawsuit against US prosecutors, when a judge agreed to dismiss his complaint after the Justice Department announced that he qualified for a transfer.

Mendoza’s case was taken up in Congress by the opposition UPyD and the Canaries Coalition

“The parties, by and through their counsel of record, represent that plaintiff’s complaint has been mooted by a recent decision by the Department of Justice, Criminal Division, Office of Enforcement Operations, International Prisoner Transfer Unit, which approved plaintiff’s prisoner transfer application,” reads the order.

It is not yet clear when Mendoza will be sent back. Since his conviction, he has been held in a federal prison in Fort Dix, New Jersey.

Spain and the United States are in discussions about other pending extradition and prisoner transfer cases.

The US government has been pressuring Spain to send back Aurea Vázquez Ríjos, the widow of a murdered wealthy Canadian who is wanted on charges related to hiring a hitman to kill her husband in the US territory in Puerto Rico 10 years ago.

Spain and the US are in discussions about other pending extradition and prisoner transfer cases

Vázquez Ríjos, a US citizen who fled to Italy, was arrested at Adolfo Suárez-Barajas International Airport in Madrid following a joint FBI-Spanish police sting operation on June 30, 2013. She is being held at Soto del Real prison outside Madrid, fighting her extradition with the help of Italian lawyers who argue, among other things, that she is not mentally fit to stand trial in the United States.

Federal prosecutors in New York have also requested the extradition of former JP Morgan broker Javier Martín-Artajo, indicted in 2013 in connection to the so-called “London whale” investor fraud scheme. Martín-Artajo appeared before the High Court this month to fight his extradition, arguing that he is a Spanish citizen and should not have to face trial in the United States.

Another former banker wanted in the United States is Cedric Cañas Maillard, who served as a close aide to former Banco de Santander CEO Alfredo Sáenz. Cañas was charged with insider trading in a federal court in New York, but his lawyers are arguing that he was acquitted by the Spanish High Court in the same case.