Gareth Patterson, Associated Press
Democratic presidential candidate Hillary Rodham Clinton speaks at a grassroots organizing meeting at Philander Smith College Monday, Sept. 21, 2015, in Little Rock, Ark.

WASHINGTON — A federal judge on Tuesday ordered the State Department to speed up its review of emails from two key aides to former Secretary of State Hillary Rodham Clinton.

U.S. District Court Judge Emmet G. Sullivan gave the department until the end of next week to complete a keyword search of thousands of work-related messages sent or received from private email accounts by aides Huma Abedin and Cheryl Mills. Mills was Clinton's chief of staff at the State Department, while Abedin was her deputy chief and considered to be among her most trusted confidantes.

The department had sought weeks longer to complete the task.

At a court hearing Tuesday, Sullivan peppered a pair of lawyers representing the State Department with skeptical questions about why it would take so much time.

"How long does it take to conduct a computer search?" he asked. "You push a button."

Once the keyword search is complete, the agency must still conduct a line-by-line review of the emails to see if they contain confidential information before they can be publicly released. The State Department said records wouldn't be ready for release until at least December, though the process could stretch well into 2016.

Sullivan set an Oct. 5 deadline for the department to report back to him on how long it will take to complete the review.

The conservative political advocacy group Citizens United sued over what it contends is the slow response to Freedom of Information Act request for emails dated between June 2012 and December 2013 — a period that includes the attack on the U.S. consulate in Benghazi, Libya. Clinton is currently seeking the Democratic Party's nomination for president.

Appearing before Sullivan, Justice Department lawyer Elizabeth Shapiro agreed with Sullivan that a simple keyword search shouldn't take weeks. But she reiterated that the Citizens United request was one of thousands being processed. There are about 30 cases alone involving the emails of Clinton and her staff that are in litigation. That has led to numerous deadlines being imposed by the judges who are overseeing the cases, she said.

"The State Department is being crushed with obligations," Shapiro said, adding that its employees are working nights and weekends to process the records requests. "Every effort is being made," she said.

The Associated Press is among the organizations suing the State Department over timely access to emails covering Clinton's tenure as Secretary of State.

Following Tuesday's hearing, Citizens United President David Bossie suggested the State Department is "slow walking" the FOIA requests to delay release of potentially embarrassing emails until after key Democratic presidential primaries are held next year.

Follow Associated Press writer Michael Biesecker at http://Twitter.com/mbieseck