Guantanamo Bay lawyer had been sentenced to 21 days’ detention by a military judge angry that he allowed civilian defense attorneys to resign from a case

WASHINGTON—Under pressure from a federal court, the Pentagon on Friday released a Marine Corps general who was put under house arrest for disobeying what he said was an illegal order that would compromise a fair trial for a Guantanamo detainee facing a potential death penalty.

Brig. Gen. John Baker, the chief defense counsel for the military commission system at Guantanamo Bay, had been sentenced to 21 days’ detention and a $1,000 fine by a military judge angry that he allowed civilian defense attorneys to resign from a case....