Requiring detainees held at the U.S. military installation at Guantánamo Bay, Cuba, to undergo genital searches before meeting with their lawyers is a “reasonable” security precaution, a federal appeals court in Washington ruled on Friday.

A three-judge panel of the U.S. Court of Appeals for the D.C. Circuit reversed a trial judge’s order striking down the policy. The court rejected the detainees’ claims that the new search policy was deliberately aimed at restricting their access to counsel because many detainees would refuse genital-area searches for religious reasons.

“The tenuous evidence of an improper motive to obstruct access to counsel in this case cannot overcome the legitimate, rational connection between the security needs of Guantánamo Bay and thorough searches of detainees,” Judge Thomas Griffith wrote.

Griffith was joined by Chief Judge Merrick Garland and Judge Karen LeCraft Henderson.

Covington & Burling senior counsel S. William Livingston argued for the detainees before the D.C. Circuit in December. He could not immediately be reached for comment on Friday.

Another lawyer for the detainees, David Muraskin of McKool Smith, said the team would consider all of its options, which could include seeking an en banc hearing or petitioning the U.S. Supreme Court.

“The D.C. Circuit allowed the administration to impose its will regardless of the consequences and fully acknowledged that the only way they would seek to intervene is if the administration admitted they were violating detainees’ rights,” Muraskin said. He added that the ruling should also worry anyone interested more broadly in prisoners’ rights.

Ultimately, Muraskin said, “the real hope is the administration will finally choose to abide by what it said and respect these individuals’ rights and attempt to send them back home.”

A spokesman for the Justice Department also could not immediately be reached. Department lawyer Edward Himmelfarb argued for the government on appeal.

The court reversed a July 2013 order by U.S. District Senior Judge Royce Lamberth blocking the search policy as “yet another exaggerated response” by the government. Lamberth agreed with the detainees that the genital-area search policy was meant to deter access to counsel.

The government argued the genital-area searches were needed to detect potential contraband, including medication and weapons. To support the new policy, officials cited the suicide of a detainee whom they said overdosed on medication and had other weapons discovered in his cell.

The detainees said the government failed to show that detainees were smuggling contraband in connection with visits with their attorneys. But Griffith wrote that the problem was that officials didn’t know how or when detainees might be getting contraband.

“In light of such uncertainty and the fact that smuggling takes place, we think administering a more thorough search in connection with attorney visits as well as with any other detainee movements or meetings is a reasonable response to a serious threat to security at Guantánamo,” he wrote.

Updated at 12 p.m.

Contact Zoe Tillman at ztillman@alm.com. On Twitter: @zoetillman.