After two decades on death row, a Mexican national at the center of an international dispute is scheduled to be put to death by lethal injection Wednesday night in Texas unless the U.S. Supreme Court steps in an issues an 11th hour stay.

Lawyers for Ruben Ramirez Cardenas asked the nation's highest court to halt the Texas execution, citing advances in DNA testing. Cardenas is set to die for the February 1997 rape and beating death of his 16-year-old cousin Mayra Laguna.

Cardenas told police he and his friend Jose Antonio Lopez Castillo were on drugs when they drove to Laguna’s apartment and raped her. When he untied his cousin she “came at me,” he said, scratching and kneeing him. He said he “lost it” and then started punching her in the face.

When he hit her in the neck, Laguna started to cough up blood. Cardenas tried to revive her. When that didn’t work, he tied her back up and “rolled her down a canal bank.”

It’s what happened next that has Mexican officials and human rights groups arguing he shouldn’t be put to death.

Cardenas' defense team, funded by the Mexican government, claims the United States violated an international treaty by denying Cardenas the opportunity to speak to his country’s consulate after his arrest.

If Texas officials execute Cardenas, they would be in apparent violation of the Vienna Convention on Consular Relations.

In 2004, the U.N.’s international court in the Hague ruled that the U.S. must review cases similar to Cardenas’. Then-President George W. Bush told states to comply but the Supreme Court overruled him and said it was up to Congress – not the president – to order states to obey.

Since then, Congress has dragged its feet.

“The result: an illegal loophole states are exploiting to execute foreign nationals in violation of international law,” the ACLU says.

The U.N. high commissioner for human rights issued a statement Tuesday calling for the death sentence “to be annulled and for Mr. Cardenas to be re-tried in compliance with international standards relating to due process and fair trial.”

Kuykendall adds that the legality of the treaty was never in question and therefore should be followed.

“It’s not a question of whether there really is a binding legal obligation or not; every justice in the Supreme Court agrees that there is,” Kuykendall, who heads up the Mexican Capital Legal Assistance Program, said. “The only question is who is going to implement the legal mechanism to put it into place.”

Mexico, unlike the U.S., does not have capital punishment. The country hasn’t weighed in on whether Cardenas committed the crimes but instead has focused on the treaty.

Cardenas also reportedly was denied a lawyer for 11 days. His attorneys argue that the DNA evidence against him is faulty, his confession was coerced and their client is innocent.

But Rene Guerra, the former local district attorney who prosecuted Cardenas, dismissed the complaints.

"I never would have authorized a case that was not there or was a flimsy investigation," he told The Associated Press. "This guy deserves the death penalty."

With only hours until his scheduled execution, Cardenas attorneys filed two federal lawsuits seeking to stop Wednesday’s execution.

One argues that Cardenas’ due process and civil rights are being violated because state officials are refusing to release evidence that could lead to new DNA testing in the case.

The other asks for a phone in the prison so Cardenas’ attorney Maurie Levin can contact the Texas governor or the courts before and during the execution.

Cell phones are typically barred from Texas prisons. There are no landlines either.

If Cardenas is executed, he would be the 166th inmate to be executed in Texas in the past decade. He’d be the 11th Mexican national to be executed in the U.S. in 35 years.

As the clock had ticked closer to midnight, attorneys on both sides waited in a tense standoff while the Supreme Court made its decision on the last appeals of a Mexican man slated for execution late Wednesday in Huntsville.

Finally, nearly four hours after he was scheduled to be executed, the court ruled against the 47-year-old Ruben Cardenas Ramirez, who has long professed his innocence in the 1997 rape and murder of his 16-year-old cousin.

“I am extraordinarily disappointed with this outcome and at the same time overcome with pride at the efforts made by his lawyer, Maurie Levin, and her team of lawyers,” said Gregory Kuykendall, an Arizona attorney authorized to speak on behalf of Mexico. “And I’m equally proud of the Mexican government for so diligently pursuing every avenue of defense conceivable.”

In the days before Cardenas’ trip to the death chamber, Mexican officials held news conferences in Mexico City and Houston, decrying the planned execution they said followed from flagrant disregard for international law. Amnesty International, the Inter-American Commission on Human Rights and the United Nations all condemned the state’s use of its harshest punishment.

Police first zeroed in on the Guanajuato native as the prime suspect in the shocking crime just hours after Mayra Laguna’s disappearance on Feb. 22, 1997. Roxanna Laguna later said she’d spotted a man slipping in through the window and snatching her older sister from the bed they shared.

When authorities pulled in Cardenas and his buddy Tony Castillo for questioning, at first they only copped to a wild night out, filled with booze and cocaine. But after hours of interrogation, they confessed to the killing.

Later, prosecutors say, Cardenas led investigators to Mayra’s body, tossed in a canal off the beaten path.

“This guy is guilty as sin,” Hidalgo County prosecutor Ted Hake reaffirmed in the weeks before the execution.

But defense counsel alleged that the multiple confessions were coerced and said police led Cardenas to the dump site and not the other way around.

Aside from raising questions about the evidence, lawyers for Cardenas and representatives of Mexico have harped on alleged violations of a consular treaty and a World Court ruling.

When authorities in Hidalgo County first arrested Cardenas, they did not immediately tell Mexico or notify the accused of his right to talk to his country’s consulate, according to court documents — an apparent oversight that violates Article 36 of the Vienna Convention on Consular Relations.

A 2004 U.N. World Court ruling mandates that foreign nationals who weren’t told of their consular rights are allowed a review to examine whether that oversight influenced the outcome of the criminal case.

Yet it was because of the lack of consular notification that Mexican officials didn’t find out about the arrest for five months — long after Cardenas had given multiple, conflicting confessions that his lawyer argues were coerced.

Cardenas repeatedly asked for a lawyer, but authorities ignored his pleas until 11 days after his arrest, instead pushing on in their interrogations without telling him about his consular notification rights, his attorney alleged in court filings.

But a 2008 U.S. Supreme Court decision deemed the U.N. order unenforceable unless Congress takes legislative action — and it hasn’t.

Wednesday’s planned execution would be the fifth time Texas put to death a Mexican national in apparent violation of international law, officials said Tuesday.Cardenas spent his final days pecking away at his typewriter and visiting with family, according to Texas Department of Criminal Justice records. On Wednesday, he refused breakfast and was transferred to the death chamber in Huntsville.

Meanwhile, in a flurry of last-minute filings, Cardenas’ lawyers struggled in a futile bid to save his life.

On Monday, the Texas Court of Criminal Appeals slapped down a pair of appellate claims seeking DNA testing, calling the request a possible stall tactic that wouldn’t be enough to prove innocence anyway.

Then on Tuesday, defense attorney Levin filed a civil suit targeting prison officials she says refused to let her watch the execution. Citing previous botched lethal injections in other states, Levin argued for the need for phone access during and before the punishment.

Federal courts denied the claim on Wednesday, along with a suit demanding DNA testing in the case. Within hours, the Fifth Circuit denied the latter claim on appeal.

Carrying out the execution without more testing “violates the most basic notions of fairness and justice,” Levin said.

The Hidalgo County district attorney did not immediately respond to a request for comment.

With hours to go before Cardenas went to the death chamber, his counsel filed two appeals begging the U.S. Supreme Court for a stay of execution, The court denied both just before 10 p.m.