In a dramatic ending before it recessed for the summer, the U.S. Supreme Court on Monday ruled 5-4 that the city of New Haven, Conn., violated the civil rights of white and Hispanic firefighters when it tossed out the results of a promotion exam after no African-Americans had passed it.

The city argued it discarded the results because it feared that it would be sued by the African-American applicants for violating Title VII by relying on a test that had “disparate impact” on minorities. That justification did not meet the court’s standard announced on Monday, which requires a “strong basis in evidence” before an employer can make employment decisions based on fear of Title VII liability. The court said instead that the city’s action was based on race and amounted to a “disparate treatment” violation of the same civil rights law.