WASHINGTON (CNN) -- A United Nations court has found that the United States violated an international treaty and the court's own order when a Mexican national was executed last year in a Texas prison.

Jose Ernesto Medellin was executed by lethal injection for raping and murdering two girls aged 14 and 16.

The International Court of Justice (ICJ) issued a ruling Monday in an unusual case that pitted President Bush against his home state in a dispute over federal authority, local sovereignty and foreign treaties. Mexico had filed a formal complaint against U.S. state and federal officials

"The United States of America has breached the obligation incumbent upon it" to stop the execution, the ICJ announced in a unanimous opinion.

Jose Ernesto Medellin's death by lethal injection in August followed a 15-year legal dispute after his conviction for two brutal slayings.

At issue was whether Texas and other states had to give in to a demand by the president that the prisoner be allowed new hearings and resentencing. Bush made that request reluctantly after the international court in 2004 concluded that Medellin and about 50 other Mexicans on various states' death rows were improperly denied access to their consulate upon arrest, a violation of a treaty signed by the United States decades ago.

Their home countries could have provided legal and other assistance to the men had they been notified, the court said.

In a separate judgment, the ICJ declined Mexico's demand that the United States provide guarantees against executing other foreign inmates in the future.

The U.S. Supreme Court last March ruled for Texas, allowing the Medellin execution to proceed.

Efforts stalled in Congress last summer over legislation that would have given foreign death row inmates like Medellin a new hearing before any punishment could be carried out.

State Department officials have said the international ruling will not help other foreign inmates in U.S. prisons, because federal officials cannot force states to comply. Administration officials also said that the president did all he could to force state compliance and that Congress now needs to intervene with specific legislation.

Medellin was 18 when he participated in the June 1993 gang rape and murder of two Harris County girls: Jennifer Ertman, 14, and Elizabeth Pena, 16. He was convicted of the crimes and sentenced to death.

The prisoner's lawyers argued that Mexican consular officials were never able to meet with the man until after his conviction.

Only Oklahoma has commuted a capital inmate's sentence to life in prison in response to the international judgment. Days after Medellin died by lethal injection, Texas executed Honduran native Heliberto Chi Acheituno, who also said his treaty rights were violated.

The ICJ in 2004 ordered the United States to provide "review and reconsideration" of the sentences and convictions of the Mexican prisoners. That world court again in July mandated that the United States do everything within its federal authority to stop Medellin's execution until his case could be further reviewed by American courts.

Based in The Hague, Netherlands, the ICJ resolves disputes between nations over treaty obligations. The 15-judge panel is the principal judicial organization of the United Nations, laying out rights of people detained in other nations.

The Supreme Court appeal turned on what role each branch of government plays to give force to international treaty obligations. After the ICJ ruling, the United States pulled out of that international court's jurisdiction in matters arising from the Vienna Convention.

In allowing the Medellin execution to proceed, the Supreme Court majority noted congressional "inaction" on the issue, efforts that had "not progressed beyond the bare introduction of a bill in the four years since the ICJ ruling."

All About U.S. Supreme Court • United Nations • Capital Punishment