Summoned before Congress and aggressively questioned by Republicans, FBI Director James Comey on Thursday strongly defended the government's decision to not prosecute Hillary Clinton over her private email setup. He said there was no evidence that she knew that anything she was doing was against the law or had lied to federal investigators.

Comey's appearance before the House Oversight and Government Reform Committee marked his first public statements since an FBI announcement that removed the threat of criminal charges against the presumptive Democratic presidential nominee but also revived public scrutiny of her handling of classified information.

Still the four-plus hours of testimony were not always east, for Comey - beyond the sometimes sharp questions he received from Republicans. "It's a pain," Comey said, in some cases literally: "I've had to go to the bathroom for about an hour."

A number of Republicans suggested there was a double standard for charging everyday people accused of crimes as opposed to high-level people like Clinton. Lawmakers asked Comey if he had been hearing that, too.

"I've heard it a lot," he said. "It's not true, but I've heard it a lot."

"I totally get people's questions," he said, but the FBI was obliged to follow the law.

Comey gave his most detailed explanation to date about why the Justice Department concluded without charges a yearlong investigation that had dogged Clinton's presidential campaign and raised questions for voters about her trustworthiness.

"Our folks did it in an apolitical and a professional way," Comey said of the FBI's handling of the investigation.

Republicans said they were infuriated with the FBI's decision and confused by the way it was presented. Comey on Tuesday gave a scathing assessment of Clinton's email practices, followed by his conclusion that "no reasonable prosecutor" would charge her with a crime.

On Thursday, Comey said the legal decision came down to a simple lack of a criminal intent.

When agents investigate allegations of criminal wrongdoing, they look for evidence not only that a statute was violated but also that a person knew that what he was doing was wrong. That evidence did not exist in this case, Comey said. Although there is a law that allows for felony prosecution for mishandling classified information due to gross negligence, that law has been used only once in the 99 years since it was enacted — and that was in a case involving espionage, Comey said.

"We don't want to put people in jail unless we prove that they knew they were doing something they shouldn't do," Comey said. "That is the characteristic of all the prosecutions involving mishandling of classified information."

Comey, a registered Republican for years though he said he now is not registered in a political party, served as deputy attorney general in the George W. Bush administration. He was appointed in 2013 to a 10-year term as FBI director by President Barack Obama.

Committee chairman, Rep. Jason Chaffetz, R-Utah, told Comey that the FBI's decision on Clinton showed a "double standard" for powerful people. Had the "average Joe" done what she had done, he said, he would go to prison.

"If your name isn't Clinton, or you're not part of the powerful elite, then Lady Justice will act differently," Chaffetz said, adding that the FBI had set a "dangerous precedent" in letting her off the hook.

Comey specifically rebutted a litany of GOP charges including that the FBI had been biased, ignored the law, applied it unjustly or coordinated the decision with Clinton's campaign. "We try very hard to apply the same standard whether you are rich or poor, white or black, old or young, famous or not known at all," he said.

The committee's top Democrat, Elijah Cummings of Maryland, accused Republicans of politicizing the investigation. But he suggested that Comey had contributed to that by leaving "a perceived gap" between his public criticism of Clinton and his conclusion not to prosecute.

"I beg you to fill the gap. Because when the gap is not filled by you, it will be filled by others," Cummings said.

Comey said that prosecutions for classified material have historically been reserved for cases of intentional or willful wrongdoing, obstruction of justice or disloyalty to the U.S. He drew distinctions between the Clinton probe and last year's prosecution of former CIA Director David Petraeus, who pleaded guilty to sharing classified information with his biographer.

Petraeus, he said, retained a "vast quantity" of classified information and then lied to the FBI about it. Comey initially said the documents had been found in Petraeus' attic, later correcting himself to say they'd been found in a desk.

"He admitted he knew that was the wrong thing to do," Comey said. "That is a perfect illustration of the kind of cases that get prosecuted. In my mind, it illustrates importantly the distinction to this case."

Attorney General Loretta Lynch said Wednesday that she accepted the recommendations and findings of Comey and of her career prosecutors and would not file charges against Clinton. Lynch is likely to face questions of her own next week at a separate oversight hearing of the House Judiciary Committee.

Rep. Elanor Norton, D-D.C., said the decision to hold a hearing on Comey's judgment "raises serious questions about the separation of powers." Cummings called Comey's need to justify his decision a "slippery slope."

House Speaker Paul Ryan, R-Wis., has said "there are a lot more questions that need to be answered" and, in a letter to Director of National Intelligence James Clapper, requested that Clinton be barred from receiving classified briefings for the rest of the campaign — a move that "certainly constitutes appropriate sanctions." Republican presidential candidate Donald Trump complained that the system was "rigged."

The hearing served as a means to energize a conservative base that might be disillusioned with Trump, as Republicans are working to hold onto their majority in Congress. But privately, some Republicans question the decision to pick a fight with Comey, a Republican from the Bush Justice Department with a reputation for independence.

On Tuesday, in a stinging assessment of her email practices as secretary of state, Comey rebuked Clinton and her aides for being "extremely careless" in their handling of classified information and contradicted many of the defenses and explanations she's put forward for months. But he also said there was no evidence anyone willfully or intentionally mishandled classified information and that "no reasonable prosecutor" would pursue such a case.

Comey, who served as deputy attorney general in the George W. Bush administration, was appointed in 2013 to a 10-year term as FBI director by President Barack Obama.