A federal judge signed written orders bringing to an end Boston's controversial 16-year school desegregation case, but he said racial quotas must be maintained when teacher layoffs are involved.

The orders include a permanent injunction against discrimination and segregation in the schools.The action Thursday confirmed four key orders U.S. District Judge W. Arthur Garrity issued orally at a May 21 meeting with attorneys from all parties involved, including school officials and the NAACP, clerk Steve Moynihan said.

Garrity also ordered Boston schools to continue hiring minorities until the staff includes 25 percent blacks and 10 percent other minorities and to maintain the racial balance even in the event of layoffs.