Navy SEAL Chief Eddie Gallagher has been released from pretrial custody ahead of his court-martial on charges for allegedly killing a wounded ISIS fighter and other offenses.

Navy Capt. Aaron Rugh, the military judge in the case, decided to release Gallagher at the end of a hearing on Thursday, said Navy Region Southwest spokesman Brian O'Rourke. Gallagher's trial is expected to begin in about two weeks.

The victory for Gallagher comes as President Donald Trump is reportedly considering pardons for the SEAL along with Army Maj. Matthew Golsteyn and three former Marine Scout Snipers who urinated on Taliban corpses.

Gallagher was originally released from the Naval Consolidated Brig in Miramar, California in March after Trump tweeted that he should be moved to a less restrictive environment.

Since then, Gallagher has been held in pretrial restriction at Naval Medical Center San Diego, his lead defense attorney Tim Parlatore said on Thursday.

“Now he's allowed out completely, so he can go to a hotel with his family,” Parlatore told Task & Purpose on Thursday. “It's a major step up because it means he can also now have a cell phone. He can have a computer with internet.”

Gallagher's legal also team includes Trump's personal attorney, Marc Mukasey and longtime associate Bernard Kerik, a former New York City police commissioner who briefly served with the Coalition Provisional Authority after the 2003 invasion of Iraq.

On Thursday, Kerik tweeted his praise for Parlatore and Mukasey for securing Gallagher's release

Parlatore said he plans to argue at a Friday hearing that charges against Gallagher should be dismissed, in part due to the prosecution's alleged attempt to spy on defense attorneys and Navy Times Editor Carl Prine.

Fox News personality Pete Hegseth has also been privately lobbying Trump to pardon Gallagher, according to The Daily Beast.

SEE ALSO: Rep. Duncan Hunter: Navy Seal Accused Of War Crimes 'Did One Bad Thing That I'm Guilty Of, Too'

WATCH NEXT: The Stoner Machinegun: A Navy SEAL Remembers