Prince George's County sheriff's officials agreed yesterday not to follow through with plans to pull their deputies out of District Court today, saying they would await resolution of a legal battle over how much the state should pay for such services.

Had the sheriff's department gone forward with the pullout, it was likely that some criminal and civil hearings would have been canceled, said Chief District Court Judge Martha F. Rasin. Hundreds of cases are heard each day in the county's courthouses in Upper Marlboro and Hyattsville.

"I'm greatly relieved. It's an interim measure which assures us a continued smooth operation of the court," Rasin said yesterday, minutes after the agreement was disclosed to Charles County Circuit Court Judge Steven G. Chappelle, who is presiding over a civil lawsuit regarding who pays for District Court security in Prince George's.

Testimony in the lawsuit, which involves the county, the sheriff's department, the State of Maryland and the state District Court, began Wednesday before Chappelle. Testimony and closing arguments are expected to conclude today, and Chappelle is expected to issue a ruling within 60 days, attorneys involved in the case said.

Under the new agreement, sheriff's deputies will continue to escort prisoners from the county detention center to court and vice versa and guard prisoners in courthouse holding cells. Civilian sheriff's public safety aides will continue to staff the metal detector checkpoints at courthouse entrances.

The only change will be that sheriff's deputies will no longer provide full-time security in county District Court courtrooms. Deputies will escort prisoners to courtrooms and escort prisoners out when their court appearance is over, officials said.

Bailiffs--retired law enforcement officers who are certified as special police officers--will provide full-time security in the courtrooms, officials said.

"The courthouse will continue to run as it has. The public will see no difference," said Stan Brown, the attorney for the sheriff's department in the lawsuit.

In recent weeks, Rasin decided that sheriff's deputies should no longer provide security at Prince George's District courthouses. Her decision was prompted in large part by the convoluted lawsuit involving the county, the sheriff's department, the District Court system and the state.

Three years ago, then-Sheriff James V. Aluisi filed a lawsuit against the county, alleging that County Executive Wayne K. Curry had slashed too much from his budget. Curry countersued Aluisi, alleging waste and mismanagement. The county also sued the State of Maryland, arguing that it should pay for many of the courthouse security duties the sheriff's department had been providing.

Many of the issues have been resolved.

In June, the state Court of Appeals ruled that the state, not the county, must pay for security at the state-funded District Court. Three weeks ago, Curry and Sheriff Alonzo D. Black, who was elected last year and is not part of the lawsuit, said they had settled the differences between their offices.

That leaves the lawsuit with one significant issue for Chappelle to decide: How much should the state pay for security at the District Court? In the past 25 years, the county has spent more than $50 million providing security at the District Court, according to County Attorney Sean Wallace. The cost of providing security at the District Court this fiscal year will be about $1.8 million, Wallace said.