WASHINGTON — The Justice Department is seeking to discourage Robert S. Mueller III’s deputies from testifying before Congress, potentially jeopardizing an agreement for two of the former prosecutors to answer lawmakers’ questions in private next week, according to two government officials familiar with the matter.

The department told the House Intelligence and Judiciary Committees last week that it was opposed to the testimony and had communicated its view to the two former members of Mr. Mueller’s team, Aaron Zebley and James L. Quarles III, according to a senior congressional official familiar with the discussions. A Justice Department official confirmed that account and said that the department had instructed both men not to appear.

It is unclear what effect the Justice Department’s intervention will have on the men’s eventual appearances, but it raises the prospect that a deal lawmakers thought they had struck last month for testimony from Mr. Mueller, the former special counsel, and the two prosecutors could still unravel.

Both Mr. Zebley and Mr. Quarles have left the Justice Department and are now private citizens, meaning that the department most likely cannot actually block their testimony. But the department’s view — depending on how strongly it is expressed — could have a chilling effect on two longtime employees and give them cover to avoid testifying.