McALESTER, Okla. — What was supposed to be the first of two executions here Tuesday night was halted when the prisoner, Clayton D. Lockett, began to twitch and gasp after he had already been declared unconscious and called out “man” and “something’s wrong,” according to witnesses.

The administering doctor intervened and discovered that “the line had blown,” said the director of corrections, Robert Patton, meaning that drugs were no longer flowing into his vein.

It was a chaotic and disastrous step in Oklahoma’s long effort to execute the two men, overcoming their objections that the state would not disclose the source of the drugs being used in a newly tried combination.

A doctor started to administer the first drug, a sedative intended to knock the man out, at 6:23 p.m. Ten minutes later, the doctor said that Lockett was unconscious and started to administer the next two drugs, a paralytic and one intended to make the heart stop.

At that point, witnesses said, things began to go awry. Lockett’s body moved, his foot shook and he mumbled, witnesses said.

At 6:37, he tried to rise and exhaled loudly. At that point, prison officials pulled a curtain in front of the witnesses and the doctor discovered a “vein failure,” Patton said.

The appeals for disclosure about the drug sources, supported by a state court in March, threw Oklahoma’s highest courts and elected officials into weeks of conflict and disarray, with courts arguing over which should consider the request for a politically unpopular stay of execution, the governor defying the state Supreme Court’s ruling for a delay, and a legislator seeking impeachment of the justices.

The planned executions of Lockett, 38, and Warner, 46, dramatized the growing tension nationally over secrecy in lethal injections as drug companies, saying they are fearful of political and even physical attack, refuse to supply drugs, and many states scramble to find new sources and try untested combinations. Several states have imposed secrecy on the suppliers of lethal injection drugs, leading to court battles over due process and the ban on cruel and unusual punishment.

Lawyers for the two convicts said the lack of supplier information made it impossible to know if the drugs were safe and effective, or might possibly violate the ban on cruel and unusual punishment.

Officials swore that the drugs were obtained legally from licensed pharmacies and had not expired. Gov. Mary Fallin, expressing the sentiment of many here, said: “Two men that do not contest their guilt in heinous murders will now face justice.”

But that question was overshadowed by Tuesday night’s disastrous mishap, which is certain to generate more challenges to lethal injection, long considered the most humane of execution methods.

Lockett was convicted of shooting a 19-year-old woman in 1999 and having her buried alive. Warner, condemned for the rape and murder of an 11-month-old girl in 1997, was to be executed two hours later.

The two men spent Tuesday in adjacent cells, visited by their lawyers and, in Warner’s case, family members. The hulking white penitentiary here in a small town of southeast Oklahoma, amid prairies now green from soaking spring rains, is the prison from which Tom Joad is paroled in the opening pages of John Steinbeck’s “The Grapes of Wrath.”

In keeping with the untried drug protocol announced by the Corrections Department this month, Lockett was first injected with midazolam, a benzodiazepine intended to render the prisoner unconscious and unable to feel pain. This was followed by injections of vecuronium bromide, a paralyzing agent that stops breathing, and then potassium chloride, which stops the heart.

This combination has been used in Florida but with a much higher dose of midazolam. Without effective sedation, the second two drugs are known to cause agonizing suffocation and pain.

Oklahoma and other states have turned to compounding pharmacies — lightly regulated laboratories that mix up drugs to order. Opponents have raised questions about quality control, especially after the widely reported dying gasps of a convict in Ohio for more than 10 minutes, and an Oklahoma inmate’s utterance, “I feel my whole body burning,” after being injected with compounded drugs.

Lockett and Warner were scheduled to be executed in March, but officials said they had been unable to buy the drugs, and the executions were delayed. Oklahoma later said it had found a federally approved manufacturer to provide the drugs but refused to identify it.

“Information on the drug that is intended to act as the anesthetic is crucial to ensure that the execution will be humane,” said Jennifer Moreno, a lawyer with the Berkeley Law School’s Death Penalty Clinic.

Elsewhere, Texas has refused to reveal where it obtained a new batch of compounded drugs; a challenge is before the state Supreme Court. Georgia passed a law last year making information about lethal drug suppliers a “confidential state secret”; a challenge is also pending in that state’s top court.

This month, the U.S. Supreme Court declined to hear suits attacking drug secrecy in Missouri and Louisiana.

But three of the justices expressed interest, and the issue seems likely to be considered by the Supreme Court at some point, said Eric M. Freedman, a professor of constitutional law at Hofstra University who considers the secrecy a violation of due process.

In March, it appeared that Lockett and Warner had won the right to know more about the drugs when an Oklahoma judge ruled that the secrecy law was unconstitutional. But the judge said she did not have the authority to grant the men stays of execution, sending the inmates into a Kafkaesque legal maze.

The state has an unusual court system, sending criminal appeals to a top criminal court and civil matters to its Supreme Court. The Court of Criminal Appeals repeatedly turned back the Supreme Court’s order to rule on a stay, while the attorney general insisted that the executions would go ahead.

On April 21, the Supreme Court said that to avoid a miscarriage of justice, it would delay the executions until it had time to resolve the secrecy matter.

The next day, Fallin, a Republican, said the Supreme Court had overstepped its powers and directed officials to carry out both executions Tuesday. An outraged legislator, Rep. Mike Christian, said he would seek to impeach the justices, who were already under fire from conservative legislators for striking down laws the court deemed unconstitutional.

A constitutional crisis appeared to be brewing. But last Wednesday, the Supreme Court announced a decision on the secrecy issue — overturning the lower court and declaring that the executions could proceed.