Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

The U.S. Supreme Court on Thursday upheld the affirmative action program at the University of Texas at Austin, ending a protracted legal battle.

The vote was 4-3.

It was not immediately clear how far-reaching the ruling will be because of the specifics of the Texas program at issue. However, the court offered a grudging agreement that in the Texas case the program is needed.

Read The Opinion

"The Court’s affirmance of the University’s admissions policy today does not necessarily mean the University may rely on that same policy without refinement," Justice Anthony M. Kennedy wrote in the majority opinion for the court. "It is the University’s ongoing obligation to engage in constant deliberation and continued reflection regarding its admissions policies."

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Justice Clarence Thomas, in joining the dissent, said the decision "is irreconcilable with strict scrutiny, rests on pernicious assumptions about race, and departs from many of our precedents."

Justice Elena Kagan recused herself because she previously worked on the case as United States solicitor general.

A Texas law guarantees admission to the university for students in roughly the top ten percent of the graduating class of any Texas high school. To fill the remaining slots, about one fourth of each entering class, the school considers several other factors, including an applicant's race.

That last step was the program under court challenge, upheld by the justices Thursday.

Abigail Fisher, who sued the University of Texas when she was not offered a spot at the university's flagship Austin campus in 2008, stands at a news conference at the American Enterprise Institute in Washington, on June 24, 2013. Charles Dharapak / AP, file

The school said students learn better when there's diversity on campus and within racial groups. But a woman who was denied admission, Abigail Fisher, filed a lawsuit claiming the diversity standard was too vague to justify making distinctions based on race.

The Supreme Court gave a limited victory to the university three years ago, agreeing that campus diversity is a worthy goal. But the justices instructed an appeals court to review whether considering an applicant's race was necessary to achieving it. When that court said it was, Fisher again appealed, leading to Thursday's decision.

Related: SCOTUS Hears Case That Could Kill College Affirmative Action

She argued that the Top Ten plan did enough to increase minority enrollment and create a racially diverse campus. In order to justify considering an applicant's race, she claimed, the university should have a more concrete goal, because racial classifications must pass a rigid legal test.

But the school said The Top Ten percent plan can go only so far, because the Texas public school system remains largely segregated. It sought the flexibility to admit minority students who, though they were not in the top ten percent of their classes, have valuable experiences, such as an African-American student who was a student body president in a mostly white school.

A demonstrator holds a sign aloft as the affirmative action in university admissions case was being heard at the Supreme Court in Washington, December 9, 2015. KEVIN LAMARQUE / Reuters

The NAACP argued that eliminating affirmative action "would set in concrete a caste system in which black and Latino UT students likely would be the products of underfunded and underperforming Texas high schools, while white UT students would likely be derived from better funded and better performing high schools."

Related: More than 160 Asian-American Groups File Briefs in Support of Affirmative Action

Many of the nation's highly selective universities, from Yale in the East to Stanford in the West, urged the court to uphold affirmative action. So did 45 Fortune 500 companies and 36 former leaders of the US military who said they need leaders from diverse backgrounds.