By SAM HANANEL

WASHINGTON — A sharply divided Supreme Court on Thursday preserved a key tool used for more than four decades to fight housing discrimination, handing a surprising victory to the Obama administration and civil rights activists.

The justices ruled 5-4 that federal housing law allows people to challenge lending rules, zoning laws and other housing practices that have a harmful impact on minority groups, even if there is no proof that companies or government agencies intended to discriminate.

Justice Anthony Kennedy, in a rare vote on the side of civil rights groups on matters of race, joined the court’s four liberal members in upholding the use of so-called “disparate impact” cases.

The ruling is a victory for housing advocates who argued that the 1968 Fair Housing Act allows challenges to race-neutral policies that have negative effects on minorities. The Justice Department has used disparate impact lawsuits to win more than $500 million in legal settlements from companies accused of bias against black and Hispanic customers.

It was a defeat for banks, insurance companies and other business groups that claimed such lawsuits – often based on statistics – are not explicitly allowed under the landmark housing law that sought to eliminate segregation that has long existed in residential housing.

“The court acknowledges the Fair Housing Act’s continuing role in moving the nation toward a more integrated society,” Kennedy said.

The White House issued a statement saying the decision “reflects the reality that discrimination often operates not just out in the open, but in more hidden forms.” And Attorney General Loretta Lynch said the Justice Department would continue to vigorously enforce the Fair Housing Act “with every tool at its disposal – including challenges based on unfair and unacceptable discriminatory effects.”

In upholding the tactic, the high court preserved a legal strategy that has been used for more than 40 years to attack discrimination in zoning laws, occupancy rules, mortgage lending practices and insurance underwriting. Every federal appeals court to consider it has upheld the practice, though the Supreme Court had never previously ruled.

Civil rights groups and the Obama administration had tried for years to keep the issue out of the Supreme Court, fearing that conservatives wanted to end the strategy. Two previous cases that reached the court were settled or strategically withdrawn just weeks before oral argument.

The latest case involved an appeal from Texas officials accused of violating the Fair Housing Act by awarding federal tax credits in a way that kept low-income housing out of white neighborhoods.

A federal appeals court said a Dallas-based fair housing group, The Inclusive Communities Project, Inc., could use statistics to show that the effect of policies used by the Texas Department of Housing and Community Affairs had a negative impact on black residents.

The fair housing group said that even if there were no motive to discriminate, the government’s policies still harmed black residents. The effect, the group claimed, was perpetuating segregated neighborhoods and denying blacks a chance to move into areas with better schools and lower crime.

Texas officials argued that it was unfair to have to justify or change policies that don’t facially discriminate. While disparate impact has been used routinely in employment discrimination cases, they said such claims were not expressly written into the housing law. They argued that allowing them would essentially force them to make race-conscious decisions to avoid liability.

Writing for the majority, Kennedy said language in the housing law banning discrimination “because of race” allows for disparate impact cases. He said such lawsuits “may prevent segregated housing patterns that might otherwise result from covert and illicit stereotyping.”

Kennedy was joined by Justice Ruth Bader Ginsburg, Stephen Breyer, Sonia Totaomayor and Elena Kagan.