NEW YORK — The retrial of a former CIA software engineer charged with leaking secrets to WikiLeaks in an espionage case will begin June 7, a judge said Wednesday.

U.S. District Judge Paul A. Crotty set the date for Joshua Schulte over the objections of a defense lawyer who said it would be impossible to properly prepare for a trial that started before August.

Earlier this year, a jury deadlocked on the most serious espionage charges alleging that Schulte stole a massive trove of the agency's hacking tools and gave it to the organization that publishes news leaks.

After the retrial, Schulte, 32, also faces child pornography charges at a separate trial.

Schulte, who remains incarcerated at a federal lockup next to the Manhattan federal courthouse, has pleaded not guilty to all charges.

Schulte worked as a coder at the agency's headquarters in Langley, Virginia, where some of the CIA's digital sleuths design computer code to spy on foreign adversaries.

The same jury that deadlocked on the most serious charges also convicted him of contempt of court and making false statements.

Prosecutors have argued that Schulte was a disgruntled employee who pulled off the largest leak of classified information in CIA history as an act of revenge.

Schulte, originally from Lubbock, Texas, was blamed for the theft after a year-long investigation that commenced when the anti-secrecy group WikiLeaks published the so-called Vault 7 leak in 2017.

By the time he was arrested, Schulte had left the agency after falling out with colleagues and supervisors and was living in New York City.

Defense attorney Sabrina Shroff told jurors at Schulte's first trial that investigators could not be sure who took the data because the CIA network in question "was the farthest thing from being secure."

"Hundreds of people had access to it," she said. "Hundreds of people could have stolen it."