HOUSTON — With less than a week to go before the scheduled execution of a man who contends his murder trial was tainted by a love affair between the judge and the prosecutor, a state judge on Thursday ordered a hearing into the accusation and the Texas attorney general called for a review of the fairness of the trial.

The judge’s order and the attorney general’s request are the latest twists in a complicated legal drama that has prompted criticism from prosecutors, judges and experts on legal ethics across the nation. They argue that if the love affair occurred, the condemned man did not receive a fair trial.

On Wednesday, 22 prominent former judges and prosecutors — among them the former F.B.I. director William S. Sessions — urged Gov. Rick Perry to put off the execution to allow more time for a hearing to determine if the claim of an affair is true.

“It is an irrevocable wrong to send a man to his death without ever hearing this critical evidence,” the group said in a letter to Governor Perry, a Republican.