WASHINGTON (AP) — A unanimous Supreme Court has ruled that thousands of people living in the U.S. for humanitarian reasons are ineligible to apply to become permanent residents.

Justice Elena Kagan wrote for the court Monday that federal immigration law prohibits people who entered the country illegally and now have Temporary Protected Status from seeking “green cards” to remain in the country permanently. The designation applies to people who come from countries ravaged by war or disaster. It protects them from deportation and allows them to work legally.

There are 400,000 people from 12 countries with TPS status.

(Story written by MARK SHERMAN/AP)

KEEP READING: Scroll to see what the big headlines were the year you were born