WASHINGTON — President Trump on Tuesday pardoned a pair of Oregon cattle ranchers who had been serving out five-year sentences for arson on federal land — punishments that inspired the armed occupation of a wildlife refuge in 2016 and brought widespread attention to anger over federal land management in the Western United States.

The case against the ranchers — Dwight L. Hammond, now 76, and his son, Steven D. Hammond, 49 — became a cause célèbre for an antigovernment group’s weekslong standoff at the Malheur National Wildlife Refuge.

The occupation, led by the Bundy family, drew hordes of militia members who commandeered government buildings and vehicles in tactical gear and long guns, promising to defend the family.

During his campaign, Mr. Trump played to that sense of Western grievance, and the pardon of the Hammonds was a signal to conservatives that he was sympathetic. His pardon in August of former Sheriff Joe Arpaio of Maricopa County, Ariz., was another such sign.