Congress voted Wednesday to open Alaska's remote Arctic National Wildlife Refuge (ANWR) to oil and natural gas drilling, ending more than four decades of heated debate on the matter.

The House voted 224-201, mostly along party lines, to pass the Republicans' tax overhaul bill, which has the ANWR drilling provision attached to it.

It followed the Senate's 51-48 vote along party lines early Wednesday morning to pass the bill. The House had passed it earlier Tuesday as well, before the GOP had to make small changes to comply with rules allowing for a 51-vote passage in the Senate as a budget reconciliation measure.

No Democrats voted for the bill on Tuesday, and only 12 House Republicans voted against it.

Once President Trump signs the legislation, Alaska leaders, Republicans and the oil industry will have accomplished a goal at the top of their energy priorities.

"Some people have been working here since I was in the second grade on this project," Speaker Paul Ryan (R-Wis.) said on the House floor Tuesday, pointing to Rep. Don Young (R-Alaska), the longest-serving member of Congress, who has made ANWR drilling a priority since he arrived in 1973. Young cheered back.

"After decades and decades in this chamber, we are opening up a small non-wilderness area of the Alaska National Wildlife Refuge for responsible development. That is the most ambitious step we have taken in years to secure our own energy future," Ryan said.

Trump boasted Wednesday at a White House meeting with his Cabinet that ANWR drilling is passing under his presidency, after so many political leaders tried unsuccessfully.

"We're going to start drilling in ANWR, one of the largest oil reserves in the world, that for 40 years this country was unable to touch. That by itself would be a massive bill," Trump told reporters assembled at the meeting.

"They've been trying to get that, the Bushes, everybody. All the way back to Reagan, Reagan tried to get it. Bush tried to get it. Everybody tried to get it," he said. "They couldn't get it passed. That just happens to be here."

But the ANWR legislation also marks a major defeat for environmentalists, who had fought off numerous attempts since the 1970s to allow drilling there. ANWR drilling has long fueled greens, helping to organize some of the first environmentalists in the movement.

While ANWR was largely overshadowed through the congressional debate by the larger tax overhaul - the most significant change to the tax code since the 1980s - it was of central importance to the lawmakers who care the most about it.

"This is an area ... that contains an estimated 10.4 billion barrels of oil," Sen. Lisa Murkowski (R-Alaska), the Senate's most outspoken ANWR drilling proponent and chairwoman of the Energy and Natural Resources Committee, said on the Senate floor, pointing to the Coastal Plain area of ANWR that would be open for drilling.

"We know we that can produce it safely. We know that we are going to need this oil in the years ahead," she continued. "The reality is is that world oil demand is rising, it is not falling. We need to bring more supply online, and we need to open up our most prospective areas. So, again, when we have a small area that has enormous potential, why, why would we continue to deny that opportunity?"

Murkowski wore earrings and a scarf depicting the Incredible Hulk on Tuesday to mark the occasion of the ANWR vote. She was honoring the late Sen. Ted Stevens (R-Alaska), who often wore a Hulk tie to the Senate when he was pushing for ANWR drilling.

ANWR drilling has long had the support of most Alaskans, the state's leaders and at least some of the Alaska Native tribes. They see it as an opportunity to boost their economy and bring in thousands of jobs for decades.

Democrats and environmentalists struggled throughout the ANWR debate to rile up opposition to drilling, with their base often focused on the larger tax bill or other GOP or Trump policies.

But they still put up a significant fight.

"Drilling in the Arctic National Wildlife Refuge is nothing more than a Big Oil polar payout," said Sen. Ed Markey (D-Mass.), a leading lawmaker opposing pro-fossil fuel policies.

"This isn't about drilling for oil; it is about drilling for votes. This isn't about crude oil; it is the crudest of politics," he said.

To opponents, ANWR drilling poses a significant threat to the ecosystem, flora and fauna of one of the wildest places on earth, host to caribou, sandpiper, polar bears and more.

"We will keep fighting, because the Arctic Refuge should forever be the home of caribou, not crude; bears, not barrels of oil; sandpipers, not pipelines," Markey said. "We will never stop fighting."

Under the legislation, the Interior Department is directed to hold at least two auctions for drilling rights leases in the next 10 years, with a limit of 2,000 acres of development.

Lawmakers estimate bids and fee will bring in $2.2 billion, since they don't expect oil production in the 10-year window. Opponents, however, say the figure is unrealistically high.

Any lease sale or drilling would likely be years away, assuming there is enough industry interest in the area for drilling. Permits and other actions would require extensive environmental review, which opponents could sue to stop from moving forward and likely will.