A federal court has ordered a town in Mississippi to desegregate its high schools and middle schools, ending a five-decade legal battle over integrating black and white students.

The ruling by the United States District Court for the Northern District of Mississippi, made Friday but announced Monday, means the middle and high school programs in the Cleveland School District, in the western part of the state, will be combined for the first time in their century-long history.

In her decision, Judge Debra M. Brown said, “Although no court order can right these wrongs, it is the duty of the district to ensure that not one more student suffers under this burden.”

Judge Brown rejected two alternatives proposed by the district as unconstitutional and ordered it to adopt a Justice Department desegregation plan, and to provide a timeline for doing so.