COLUMBIA, S.C. — An agreement between South Carolina’s education agency and a historically failing school district ended a lawsuit Friday claiming the state unconstitutionally seized control from the locally elected board.

Officials with the state and Allendale County School District jointly asked the state Supreme Court to dismiss the case filed last month.

The lawsuit followed Superintendent Molly Spearman’s emergency declaration to take over the rural county’s four schools.

The agreement restores some authority to the local board. That includes giving final budget approval, hearing student discipline appeals and providing input on hiring decisions.

But Spearman retains the final say over hiring of all school and district leaders, including the district superintendent who will consult with the agency. The board also agrees not to influence or interfere with day-to-day operations, including teacher contracts, evaluations and dismissals.

It also promises to cooperate with state audits and use the findings to correct problems.

Agency spokesman Ryan Brown said the agreement avoids an expensive court fight.

“We’re not wasting a ton of taxpayer dollars to fight it out in Supreme Court,” he said. “And it will put people at ease in the district. We want to work with the local board.”

The board chairwoman did not immediately return a request for comment.

The 18-month agreement will be renegotiated based on audits and next year’s student testing results. It can be voided if the state finds corruption or fraud.

Since 1998, state law has allowed the Education Department to take over persistently failing schools or districts. But Allendale County remains the only district where the state’s seized control of all schools.

A clause the Legislature inserted into recent budgets sped up the process — letting Spearman make the decision directly.

The school district argued in its lawsuit that the state budget can’t give that power because an elected board’s right to govern and spend state money “does not reasonably and inherently relate to the raising and spending of tax monies.”

The education agency attempted earlier this year to negotiate an improvement plan that would have avoided the emergency declaration, but the local board refused to sign it, Spearman said. The board even rescinded her invitation to its June meeting, where she’d planned to make a presentation.

Student performance in one of the state’s poorest counties has ranked at or near the bottom in the state for decades. The state last seized control of the county’s schools in 1999. Although scores improved, the district was still rated “at risk” — the worst grade on state report cards — when the local board regained full authority in 2007.

Last year, more than 80 percent of students in grades three through eight did not meet expectations on math and reading state-standardized tests. And not a single 11th-grader received an overall ACT score considered “college ready.”

Last year, Spearman took control of two long-failing schools in tiny Timmonsville in Florence County, representing the only other time the education agency has used its authority under South Carolina’s accountability law. But the Florence 4 school board retained control of its district operations and high school.

Spearman’s predecessors avoided takeovers, partly because the backlash stirred up by Allendale County officials the last time made the task increasingly challenging.

Spearman believes a different strategy and parental backing will produce better results this time.