Police advance through a cloud of tear gas toward demonstrators protesting the killing of Michael Brown, in Ferguson, Missouri, Aug. 17, 2014. Scott Olson/Getty Images

A federal judge on Tuesday approved an agreement between the U.S. Justice Department and Ferguson, Missouri, to reform the city's police department, a pact prompted by the 2014 shooting of an unarmed black man that sparked violent protests.

U.S. District Judge Catherine Perry of Missouri's Eastern District approved the 129-page accord, which also outlines the revamping of the St. Louis suburb's municipal law code.

The Justice Department and Ferguson recognize "that the ability of a police department to protect the community it serves is only as strong as the relationship it has with that community," the consent decree signed by Perry said.

The agreement requires Ferguson police officers to undergo bias-awareness training and the department must implement an accountability system.

The city also agreed that police must ensure that stop, search and arrest practices do not discriminate on the basis of race or other factors protected under law.

The largely black community of Ferguson erupted into violent protests in 2014 after a grand jury chose not to indict white Ferguson police officer Darren Wilson in the fatal shooting of unarmed 18-year-old African-American Michael Brown.

The city council in Ferguson approved the agreement in March after receiving assurances from the Justice Department that it would work with Ferguson to ensure it would not cripple city finances.

A number of U.S. cities have entered into police reform pacts, including Seattle, Washington and Albuquerque, New Mexico.

The decree came the day that a white St. Louis police officer shot and killed a black carjacking suspect about 10 miles southeast of Ferguson.

St. Louis Metropolitan Police Chief Sam Dotson told reporters the suspect pointed a gun at officers and one opened fire. No officers were injured and there was no dash camera in the police cruiser, he said.