Attorney General Eric H. Holder Jr. on Tuesday defended the federal investigation of D.C. Mayor Vincent C. Gray, but acknowledged the “awkward” timing of new allegations about the mayor in the weeks before this month’s election.

Holder stood behind the Justice Department’s decision to make public a plea agreement that implicated Gray (D) in a campaign finance conspiracy three weeks before the April 1 primary that made him a one-term mayor.

“What we do is simply bring the cases when they’re ready to go,” Holder said in response to a question during a lengthy House Judiciary Committee oversight hearing. “And sometimes it is awkward, but it is the best way in which to do these things, irrespective of what the political fallout is going to be.”

Ronald C. Machen Jr., the U.S. attorney for the District of Columbia, has been criticized for the timing of the allegations that Gray knew about and helped orchestrate an illegal, off-the-books effort to help his 2010 campaign effort. The description of the mayor’s conduct came in a plea deal with D.C. businessman Jeffrey E. Thompson, a former city contractor who admitted secretly funneling more than $2 million to a long list of local and federal campaigns over many years.

Gray has not been charged and has rejected Thompson’s allegations as “lies.” The mayor and his supporters have suggested that Machen played a role in Gray’s loss in the Democratic primary to council member Muriel Bowser (D-Ward 4), and said the timing of Thompson’s deal unfairly influenced the election results.

U.S. Attorney General Eric Holder speaks during a news conference in New York on April 1. (Seth Wenig/AP)

The mayor’s allies have called Thompson’s agreement, which calls for possible jail time of up to six months, a sweetheart deal. And a District lawyer and Gray supporter filed a formal complaint against Machen last month with the D.C. Office of Bar Counsel, accusing him of improperly interfering with the primary.

The question for Holder on Tuesday about the impact of the investigation on the election came from Rep. Cedric L. Richmond (D-La.), who suggested that the information could have remained sealed by the court in the lead-up to the election.

Holder said he understood the concern, but that the Justice Department would also have been criticized for waiting until after the election to reveal what investigators had learned.

“We would have been charged potentially with withholding information that would have been relevant for voters to have,” Holder said.

Machen’s office has said in response to criticism that the “criminal investigation has been dictated by the state of the evidence, not by the news cycle or the election calendar.”