A Mexican federal judge threw out a five-year, money-laundering sentence for Sandra Avila Beltran, ordering the immediate release of the "Queen of the Pacific" for her alleged role as a liaison between Mexican and Colombian drug cartels.

A statement issued Saturday by the Attorney General's Office said the judge ruled that Avila already had been tried for the same crime in Mexico and the United States.

The ruling brings to an end a saga that began in 2007, when Avila was arrested while sipping coffee in a Mexico City diner.

Her case is widely known in Mexico because Avila is the niece of Miguel Angel Felix Gallardo, "the godfather" of Mexican drug smuggling who is serving a 40-year sentence for trafficking and the murder of U.S. Drug Enforcement Administration agent Enrique Camarena in 1985.

Prosecutors alleged Avila spent more than a decade working her way to the top of Mexico's drug trade. They said her romance with Colombian Juan Diego Espinoza Ramirez brought together Mexico's powerful Sinaloa cartel with Colombia's Norte del Valle cartel.

Avila was tried in connection with the seizure of more than nine tons of U.S.-bound cocaine on a vessel in Mexico's western port of Manzanillo and acquitted in December 2010. A Mexican appeals court upheld the verdict in 2011.

But she remained jailed while Mexican courts decided on a U.S. extradition request, which judges granted in 2012. Avila also faced charges stemming from several seizures in Chicago in 2001 that amounted to 100 kilograms of cocaine.

A 2004 indictment in the Southern District of Florida did not specify Beltran's role in the drug-dealing case. In a plea deal in Miami in 2013, she pleaded guilty to a lesser count of being an accessory after the fact in an organization that included Espinosa Ramirez, who pleaded guilty in 2009 to cocaine trafficking charges.

She was sentenced to time served and returned to Mexico, where she was sentenced on the money-laundering conviction last year.