Eleven detainees at the US military's Guantanamo Bay prison

Eleven detainees at the US military's Guantanamo Bay prison sued President Donald Trump Thursday saying they were being illegally held on the basis of being Muslims.

Following a strategy previously used by opponents of Trump's travel ban on visitors from six mostly-Muslim countries, the detainees cited Trump's tweets and other comments expressing anti-Islam sentiments as evidence.

They also cited his comments that no Guantanamo detainees should ever be released, a shift from previous administrations' stances that the 41 detainees there should still face status reviews or be tried by military tribunals -- even if few of those proceedings have begun.

"The president's opposition to prisoner releases from Guantanamo tracks other indiscriminate policy initiatives of his –- which have been struck down by the courts –- including the iterative bans on travel to the United States from certain majority-Muslim countries and the ban on transgendered Americans serving in the armed forces," the suit said.

"His stance on Guantanamo calls for no less searching judicial scrutiny."

It took note of recent mass murder attacks inside the United States to underscore Trump's alleged anti-Muslim views.

Trump "more recently called for a Muslim man who killed several people in New York to be sent to Guantanamo and denied constitutional process, though he has never suggested that white male mass killers should ever be denied due process," it said.

- Sixteen years of Guantanamo -

The suit, filed in federal court in Washington on the 16th anniversary of the establishment of the Guantanamo facility, demanded the prisoners be granted habeas corpus rights to be charged or released.

They argued that Trump's administration has signaled that it does not intend to ever release them, in violation of US and international law.

"President Trump, in contrast to his predecessors, has declared and is carrying out his intention to keep all remaining detainees in Guantanamo, regardless of their individual circumstances –- presumably even those the executive branch previously determined need no longer be detained," it said.

"It is a demonstration of his antipathy toward this prisoner population, all foreign-born Muslim men, and toward Muslims more broadly, of the kind courts have properly rejected in recent months."

- Novel legal approach -

Karen Greenberg, director of the Center on National Security at Fordham Law School, called the habeas petition a novel new approach for the detainees, some in the prison since 2002.

The approach is taking cues from news and events during the Trump administration.

Speaking at the New America think tank, Greenberg, noted a new challenge that surfaced in the pre-trial hearing in Guantanamo on Wednesday of alleged September 11 attacks planner Khalid Sheikh Mohammed.

Sheikh Mohammed alleged Guantanamo prisoners were victims of persistent "sexual harassment" because guards were submitting them to repeated physical "groin searches" rather than using scanners.

Greenberg and other activists speaking at New America said the Trump administration had changed government policy to essentially close the doors for any possible exit from the Guantanamo camp, which at its peak had 775 detainees.

Under Trump, "you can't get out of Guantanamo any more via the law," said Andy Worthington, co-founder of the Close Guantanamo group.

"You can only get out at the whims of the president of the United States."