MONTGOMERY — Alabama won't face possible federal court sanctions for failing to meet mental health staffing targets after attorneys told a judge Monday they have reached a temporary agreement.

A scheduled Monday contempt hearing was canceled after lawyers for the Alabama Department of Corrections and state inmates said they have agreed how to measure compliance with his order to boost mental health staff in state prisons.

U.S. District Judge Myron Thompson must approve the agreement.

Attorney Maria Morris, who represents the inmates, said they believe the state is short of the staffing requirement of 263 full-time positions. Morris said the shortages are the highest in positions with the most advanced training such as psychiatrists and nurse practitioners.

"It is our position that they failed to meet the deadline," Morris said. However, Morris said they agreed to drop their request to hold the state in contempt in exchange for the agreement which more concretely spells out what is compliance and how to handle disputes moving forward.

The prison system had acknowledged that its health care vendor was having trouble filling all of the positions but disputed that it was in contempt.

"In sum, the state is not contending that it has fulfilled every requirement of the staffing remedial order. But it has made in good faith all reasonable efforts to do so, and those efforts have resulted in substantial progress," attorneys for the state wrote last month.

Judge Thompson last year ruled that mental health care was "horrendously inadequate" in state prisons and created unconstitutional conditions. The ruling came after the Southern Poverty Law Center and the Alabama Disabilities Advocacy Program filed a class-action lawsuit over health care in state prisons.

The first inmate to testify at the trial killed himself days after describing past suicide attempts and a lack of psychiatric treatment while in state custody.

The two sides had disputed whether compliance with the staffing order should be measured by the number of positions filled or the number of hours worked. Attorneys told Thompson they had settled on an hours worked model.

Plaintiffs agreed not to seek another contempt motion on staffing levels until June.