A lawsuit filed on Wednesday accuses US President Donald Trump and senior administration officials of subjecting more than 1 000 undocumented immigrants to “inhumane” conditions at a federal prison in California.

Since June 8 the group of detainees have been imprisoned “in violation of their constitutional rights”, according to the complaint.

“They are locked in prison cells for much of the day and all night. No health care provider has assessed them,” it says.

The suit was filed a day after lawmakers assailed the Trump administration for its controversial border policy, which in another widely condemned case has led to the separation of more than 2 500 undocumented migrant children from their parents or guardians.

The complaint says the immigrants in California have been subjected to “harsh prison conditions that can only reasonably be described as punitive and inhumane”.

Trump, Secretary of Homeland Security Kirstjen Nielsen, Attorney General Jeff Sessions, officials from Immigration and Customs Enforcement and others are named as defendants.

The detainees are only allowed to exercise outdoors for a few hours a week, and are prevented from worshipping freely, the suit says.

“In the chow hall, they are offered inadequate and, at times, inedible food, such as spoiled milk and sandwiches that consist of just two slices of bread,” it adds.

Immigration and Customs Enforcement — which the suit says transferred the detainees to the prison in early June — declined to comment.

“Confining immigrants in these conditions is unconscionable and unconstitutional,” said Victoria Lopez, an attorney with the American Civil Liberties Union, one of the organizations that filed the complaint on behalf of the detainees.

Margot Mendelson of the Prison Law Office, another organisation involved in the suit, said that people should not be imprisoned for seeking asylum in the US.

“The federal government is needlessly locking these individuals into a medium-security federal prison, and is depriving them of basic human needs such as health care, food, and sunlight,” Mendelson said.