LITTLE ROCK — The U.S. Supreme Court ruled Monday that an Alabama inmate was improperly denied access to a mental health expert, a decision that could affect the cases of two Arkansas death-row inmates who have made similar claims.

In a 5-4 decision, the nation’s highest court said an Alabama judge erred in denying a motion by a lawyer for James McWilliams, who is indigent, to allow a psychiatrist to review and evaluate McWilliams’ mental health records at the state’s expense. After denying the motion, the judge sentenced McWilliams to death for capital murder on a jury’s recommendation.

In its majority opinion written by Justice Stephen Breyer, the Supreme Court cited its 1985 decision in the case Ake v. Oklahoma. In that decision the high court said that when an indigent defendant’s mental health will be a significant factor at trial, the state must provide the defendant with access to a competent psychiatrist who will conduct an appropriate examination and assist in evaluation, preparation and presentation of the defense.

The Supreme Court said McWilliams was examined by a psychiatrist, but he received no assistance from a psychiatrist in evaluating the examination results and preparing and presenting a defense.

Justice Sam Alito wrote in a dissenting opinion that the majority failed to answer the question of whether Ake v. Oklahoma established that an indigent defendant whose mental health will be a significant factor at trial is entitled to the assistance of a psychiatric expert who is a member of the defense team instead of a neutral expert who is available to assist both the prosecution and the defense.

“The answer to that question is plain: Ake did not clearly establish that a defendant is entitled to an expert who is a member of the defense team,” so McWilliams’ rights were not violated and his sentence should be affirmed, Alito wrote.

Joining Alito in the dissent were Chief Justice John Roberts and Justices Clarence Thomas and Neil Gorsuch.

Bryer wrote in the majority opinion that it was not necessary for the court to reach the question the minority said should have been answered. McWilliams did not get any help beyond an examination from a psychiatrist, either on the defense team or not, he noted.

“It is not necessary … for us to decide whether the Constitution requires states to satisfy Ake’s demands in this way. That is because Alabama here did not meet even Ake’s most basic requirements,” Breyer wrote.

On April 17, the Arkansas Supreme Court stayed the executions of Don William Davis and Bruce Earl Ward, who had been scheduled to be put to death by lethal injection that night. The men’s lawyers had asked for the stays, arguing that Davis and Ward have been denied access to independent mental health experts at state expense, which the lawyers argued is the men’s right as indigent defendants under Ake v. Oklahoma.

The lawyers for Davis and Ward had asked the state Supreme Court to stay their executions until after the U.S. Supreme Court issued a decision in James McWilliams’ case. The state had argued that the outcome of the McWilliams case would not affect Davis and Ward.

The state Supreme Court’s decisions to grant the stays were 4-3. Justices Karen Baker, Rhonda Wood and Shawn Womack dissented.

The state’s highest court also issued a separate order April 17 staying Ward’s execution, granting a request from lawyers who said they needed time to show that Ward should not be executed because he is mentally incompetent. Baker, Wood and Womack dissented.

Scott Braden, a federal public defender representing Davis and Ward, did not immediately return a call Monday seeking comment.

Davis, 54, has been sentenced to die for the 1990 shooting of 62-year-old Jane Daniel of Rogers during a robbery at her home.

Ward, 60, has been sentenced to die for the 1990 strangulation of 18-year-old Little Rock convenience store clerk Rebecca Lynn Doss.

Davis and Ward originally were scheduled to be the first of eight men executed over an 11-day span in April. Court rulings stayed four of the executions.