WASHINGTON — The Endangered Species Act, which for 45 years has safeguarded fragile wildlife while blocking ranching, logging and oil drilling on protected habitats, is coming under attack from lawmakers, the White House and industry on a scale not seen in decades, driven partly by fears that the Republicans will lose ground in November’s midterm elections.

In the past two weeks, more than two dozen pieces of legislation, policy initiatives and amendments designed to weaken the law have been either introduced or voted on in Congress or proposed by the Trump administration.

The actions included a bill to strip protections from the gray wolf in Wyoming and along the western Great Lakes; a plan to keep the sage grouse, a chicken-size bird that inhabits millions of oil-rich acres in the West, from being listed as endangered for the next decade; and a measure to remove from the endangered list the American burying beetle, an orange-flecked insect that has long been the bane of oil companies that would like to drill on the land where it lives.

“It’s probably the best chance that we have had in 25 years to actually make any substantial changes,” said Richard Pombo, a former congressman from California who more than a decade ago led an attempt to rethink the act and is now a lobbyist whose clients include mining and water management companies.