WASHINGTON — The F.B.I.’s former top lawyer told congressional officials in private testimony last week that he had taken seriously a suggestion by the deputy attorney general, Rod J. Rosenstein, to secretly tape conversations with President Trump but viewed it as too risky and unlikely to deliver meaningful information.

F.B.I. officials dismissed the idea within days, according to James A. Baker, then the bureau’s general counsel, but his testimony shows that F.B.I. leaders played out its potential ramifications before rejecting it.

Mr. Baker’s account contradicts Mr. Rosenstein’s denial of a New York Times article last month that said he suggested recording the president and discussed recruiting cabinet members to invoke the 25th Amendment to remove Mr. Trump from office. It also undermines an assertion provided by the Justice Department from a law enforcement official present on one of the occasions when Mr. Rosenstein broached the idea of taping Mr. Trump and said he was being sarcastic.

[Read: Rod Rosenstein Suggested Secretly Recording Trump and Discussed 25th Amendment]

Mr. Baker said that he learned of Mr. Rosenstein’s suggestion of wearing a wire into the Oval Office not long after he made it, either from Andrew G. McCabe, the acting F.B.I. director at the time, or a senior bureau lawyer, Lisa Page. Legal concerns aside, Mr. Baker testified, the approach made little practical sense to him and he never conducted a formal legal analysis.