A military judge has ruled that plea agreements struck by alleged September 11 mastermind Khalid Sheikh Mohammed and two co-defendants are valid, voiding an order by Defence Secretary Lloyd Austin to throw out the deals, a government official said Wednesday.