WASHINGTON — At workplaces across the United States, it is routine for Americans’ conversations to turn to President Trump — whether his policies are good, whether he should be impeached, what to think about the “resistance.” Some drink from MAGA mugs; others tape cartoons to their cubicle walls portraying Mr. Trump as a Russian quisling.

But roughly two million people who work for the federal government have now been told that it may be illegal for them to participate in such discussions at work — a pronouncement that legal specialists say breaks new ground, and that some criticized as going too far.

Generally, federal employees have been free to express opinions about policies and legislative activity at work as long as they do not advocate voting for or against particular candidates in partisan elections. But in a guidance document distributed on Wednesday, the independent agency that enforces the Hatch Act, a law that bars federal employees from taking part in partisan political campaigns at work or in an official capacity, warned that making or displaying statements at work about impeaching or resisting Mr. Trump is likely to amount to illegal political activity.

[Read the new Hatch Act guidance.]

The guidance was issued by the Office of Special Counsel, an independent agency that enforces the Hatch Act, including by investigating complaints of improper political activity and recommending discipline — like a reprimand or firing — for violators. The agency also enforces the Hatch Act against state and local government officials whose salaries come from federal grants.