A federal judge questioned the Obama administration’s “good faith” in helping keep former Secretary of State Hillary Clinton’s emails secret for six years and said he may end up issuing a subpoena to force her to turn over her entire account to the government.

That could give the group — and the broader public — answers as to who approved Mrs. Clinton’s unique arrangement, who else in government knew about it and why they shielded it for so long. It also could force Mrs. Clinton to answer questions about how she sorted through her account and decided which messages she didn’t want to turn over to the government.

Judge Sullivan said he is “inclined” to issue a subpoena demanding that Mrs. Clinton and top aide Huma Abedin turn over the entire email system they used. He delayed that decision, saying he will wait to see what he learns from the discovery process, but was irked by answers the Obama administration has given.

“How on earth can the court conclude there is not at minimum a reasonable suspicion of bad faith?” Judge Sullivan said.

With Mrs. Clinton fighting for the presidency, news that her emails could remain a controversy for months is troubling.

But Judge Sullivan said it’s all the result of her unique arrangement, in which she rejected use of the State Department’s server and instead conducted all of her official business on an account tied to a server she kept at her home in New York.

“We’re not talking about any federal employee. We’re talking about the secretary of state,” he said.

With Mrs. Clinton out of office and on the campaign trail, it has been left to President Obama and his team to pick up her defense. The administration repeatedly tried to derail Judge Sullivan on Tuesday, saying the State Department has already pleaded with Mrs. Clinton to return any government emails she has.

“State has really done everything it can to get these records,” said Steven Myers, a Justice Department lawyer handling the case for the government.

Mrs. Clinton left office in early 2013. Nearly two years later, and only after prodding by the congressional probe into the 2012 Benghazi terrorist attack, she turned over to the State Department some 32,000 emails covering 55,000 printed pages.

But she said another 30,000 messages were sent during her four years in office that her attorneys deemed to be purely private. She said they dealt with issues such as scheduling her yoga classes or planning her daughter Chelsea’s wedding.

She refused to turn over those messages, saying it was her right as a government employee to decide what emails were official records.

Judicial Watch, though, said Mrs. Clinton lost that right when she left the government. The group argued that it should be current government employees, either at the National Archives or the State Department, who make that determination.

Judge Sullivan seemed to agree, saying that even if Mrs. Clinton were still in office, it would be some other open-records officer, not Mrs. Clinton herself, who would be going through her emails.

The judge repeatedly questioned how the State Department could have allowed the situation in the first place.

He said it was clear that top officials knew about Mrs. Clinton’s secret account, yet for years, open-records requests were handled without any of those emails being produced.

“We’re talking about a Cabinet-level official who was accommodated by the government, for reasons unknown,” he said. “This is about the public’s right to know.”

Mrs. Clinton has said she rejected the State Department’s offer of an email account out of convenience for herself. She said she wanted to carry only one device and handle all of her public and private business on it.

The FBI is investigating Mrs. Clinton’s use of the server, where she kept more than 1,700 messages now deemed to have classified information, 22 of which contain top-secret material.

The State Department’s internal watchdog is also looking into the arrangement, Mr. Myers said, pleading with Judge Sullivan to stand down and wait for those investigations to play out.

Judicial Watch’s original open-records request sought information on Ms. Abedin’s own unique arrangement with the State Department, in which she was allowed to work for outside interests while collecting her government salary.

Judicial Watch President Tom Fitton said the organization was happy with the ruling Tuesday.

“It’s a significant victory for public accountability,” he said.

Dozens of other cases also have been filed seeking other messages from Mrs. Clinton, Ms. Abedin and several other top aides.

He said the entire process of creating and maintaining the secret email system, which Mrs. Clinton kept at her home in New York, raises questions about whether she was trying to thwart the law. He said he has not come to that conclusion yet.

He also said the State Department has hurt its own case by claiming several times that it had conducted a full search only to later come back and acknowledge it found places it hadn’t checked.

“It just boggles the mind that the State Department allowed this circumstance to arise in the first place,” the judge said.