WASHINGTON—The Obama administration pressed Congress to revive legislation that would give stronger protections to reporters, responding to widespread criticism over the Justice Department's broad seizure of Associated Press phone records.

House Republicans, at a contentious four-hour hearing Wednesday, barraged Attorney General Eric Holder with questions about the AP case and other issues, including the Internal Revenue Service's targeting of conservative groups.

The AP seizures were part of a Justice Department investigation into national-security leaks. The subpoenas appeared to be handled "contrary to the law and standard procedure," Rep. Bob Goodlatte (R., Va.), chairman of the House Judiciary Committee, told Mr. Holder.

Later in the hearing, the exchange between Mr. Holder and Republicans grew more personal. Rep. Darrell Issa (R., Calif.), who last year led an effort that resulted in a vote to hold the attorney general in contempt of Congress, accused him of withholding information. Mr. Holder responded by calling Mr. Issa's conduct "shameful."

As lawmakers from both parties criticized the AP subpoenas, Mr. Holder mostly avoided questions about them, saying he was recused from the case and Deputy Attorney General James Cole was the person who authorized the subpoenas.

As the hearing stretched past 5 p.m., Mr. Holder lamented what he called the "toxic partisan atmosphere" and said he hadn't been shown the respect due an attorney general. He said, "I didn't show up here because I really wanted to."

Republicans said Mr. Holder was the one at fault, accusing him of failing to be forthcoming and criticizing him for saying he couldn't comment on investigations in progress. "You don't have all that much credibility," said Rep. Jim Jordan (R., Ohio). "You've been held in contempt and a host of other things."

In the wake of the AP controversy, President Barack Obama's chief spokesman, Jay Carney, said the White House talked to Sen. Charles Schumer (D., N.Y.) about reviving "media shield" legislation that would protect journalists from revealing sources as part of an investigation. Mr. Schumer has been a chief proponent of such a law, though an effort to pass it in Mr. Obama's first year in office failed.

The AP has said the government obtained records involving more than 20 phone lines used by its journalists and denounced the move as an intrusion into news gathering. The Justice Department has defended the actions, saying that a leak to the news organization about a 2012 counterterrorism operation put Americans at risk and required an aggressive response. The person responsible for the leak hasn't been identified and the investigation continues.

The episode has proved embarrassing to Mr. Obama. As a presidential candidate in 2008, he supported journalist protections in the form of a federal shield law. He has also often noted his commitment to government transparency. Renewing the effort to pass a shield law is a way for Mr. Obama to answer critics without appearing to meddle in a Justice Department probe.

Mr. Carney said the president wants to seek a balance between giving journalists the freedom to do their jobs and protecting national-security interests. "He does believe that it is appropriate to resubmit that [media-shield] legislation and to try to convert it into law at this time," Mr. Carney said.

Mr. Schumer said, "Right now, there are no guidelines, and we feel that there should be guidelines." He added, "It shouldn't be any time a government official wants information from the press that they can just get it."

Journalism advocacy groups said they welcomed the renewed interest in protecting journalists, though the effectiveness of a shield law would depend on how it is written and how easily the Justice Department could override the protections, citing national-security concerns.

"When you talk about a shield law, it's often completely dependent on what they end up with," said Gregg Leslie, legal defense director for the Reporters Committee for Freedom of the Press. "If you keep watering down certain elements…you can end up with a law that doesn't mean much."

The AP subpoenas were connected to a probe by Ronald Machen, U.S. attorney for the District of Columbia, into a leak concerning a 2012 counterterrorism operation in Yemen. Mr. Holder said that he recused himself because he was interviewed by investigators over the leak and was a "fact witness" in the case. Mr. Holder said he didn't know whether he put the recusal in writing but said that "might be the better practice" in such cases.

—Peter Nicholas and Evan Perez contributed to this article.

Write to Jared A. Favole at jared.favole@dowjones.com and Brent Kendall at brent.kendall@dowjones.com