A deal on energy is playing a key role in the new budget proposal.

After 40 years, Democrats are giving up the fight over lifting crude oil export restrictions that have effectively banned most sales of U.S. crude oil abroad. In return, Republicans are dropping their opposition to lengthy extensions of the solar and wind tax credits that will give huge boosts to renewable energy projects.

“The spending bill is that rare example of bipartisan compromise that actually yields positive outcomes all around—ending an outdated ban on free trade in oil, plus multi-year support for clean energy that will allow solar and wind to keep growing at a fast clip,” said Jason Bordoff, founding director of Columbia University’s Center on Global Energy Policy.

The omnibus budget bill released Tuesday night would allow all crude oil exports except in certain economic or national security emergencies.

The budget compromise also includes a five-year extension of the investment tax credit for solar and an extension of the production tax credit for wind retroactively to last year and ending in 2019. The wind credits are pegged to the start of construction rather than the start of production, extending the benefits for companies. But the deal would phase down the credits 20 percent each year.

The change in oil export rules is a triumph for the American Petroleum Institute, shale oil producers in states like Texas and North Dakota, free trade economists from both parties, and Sens. Lisa Murkowsi (R-Alaska) and Heidi Heitkamp (D-N.D.), whose home state producers – battered by the recent plunge in oil prices — will be able to get somewhat higher prices abroad.

Many Republicans also argued that if the United States were going to lift restrictions on Iranian crude oil exports as part of the deal limiting Iran’s nuclear program then limits on U.S. crude oil exports should also be lifted.

The budget’s solar and wind tax credits also extend support for renewable energy central to President Obama’s push to lower greenhouse gas emissions as part of the international climate deal struck in Paris last weekend. The tax credit for wind is also favored by Great Plains lawmakers from both parties.

The Solar Energy Industries Association said that the extension of the investment tax credit, due to expire at the end of 2016, would lead to $125 billion in new private sector investment in the United States and that solar power would triple by 2022 to 95 gigawatts, equal to about 3.5 percent of U.S. electricity generation, offsetting emissions equivalent to 26 coal-fired power plants.

Despite rapid reductions in the cost of wind and solar, both still rely heavily on government subsidies. Bloomberg New Energy Finance has estimated that without the extension of the investment tax credit, solar installations would fall 70 percent in 2017 whereas an extension would boost solar projects by 50 percent through 2022.

The end of the crude oil export ban has been a symbolic as well as economic issue for Congress. First imposed in 1975 in the wake of the Arab oil embargo, the ban directed the president to draw up rules “prohibiting” crude oil exports. The president was allowed to make exceptions in cases of national interest, and minor exceptions largely included some sales to Canada that made logistical sense. As domestic oil production sank steadily through 2009, there was no outcry for export permits.

But the boom in shale oil production since 2009 has changed that. The United States still imports more than 9 million barrels a day, but there has been a surge in shale oil, which is a high-quality oil in demand in Europe and elsewhere, where many refineries cannot handle low-quality crudes. By contrast, U.S. refineries especially along the Gulf coast have been mostly upgraded to handle low-quality crude that can be imported from Canada, Venezuela and Saudi Arabia.

Without being able to export, large portions of the North Dakota shale oil has been shipped by train to older East Coast refineries able to drive harder bargains because the shale oil producers have fewer choices.

Most economists say that lifting the export restrictions would have little impact on U.S. consumers. While high-quality U.S. crude prices will rise slightly, the price of imported low-quality crudes should fall by a similar amount.

“We have a long history of believing that export restrictions are not an appropriate policy tool,” Lawrence H. Summers, former Treasury Secretary, Harvard University president and head of President Obama’s national economic council said at a Brookings Institution event in September 2014.

He said: “The merits [of lifting restrictions] are as clear as the merits with respect to any significant public policy issue that I have ever encountered.”

The tradeoff on energy was made easier for the Obama administration by language inserted in the budget compromise that would give the president the ability to impose restrictions on oil exports, like licensing requirements, for up to one year under certain special circumstances – and if necessary, the ability to extend those requirements or restrictions annually. Some of these special circumstances include: national security threats, national emergencies, sustained crude oil shortages, and when supply shortages or price increase are likely to negatively impact employment. (There are no restrictions on the export of refined petroleum products and refiners have long sold gasoline and diesel fuel abroad.)

Although the administration has long opposed the lifting of crude oil restrictions, earlier in the week White House spokesman Josh Earnest had refused to say the president would veto a budget bill over the item. Instead he said the White House opposed the change on “procedural” grounds because the executive branch should be responsible for making the decision.

On Wednesday, Earnest said the United States already exports 4.3 million barrels a day of refined petroleum products and as a result of waivers issued by the administration, producers currently export about half a million barrels a day of crude and condensates.

The companies most likely to benefit are the big North Dakota producers including Continental Resources, Hess, EOG, Whiting and Statoil. The Obama administration had already made certain export exceptions of some very light crude oil, known as condensate, mostly produced in Texas.

But with the recent plunge in the price of crude oil, now selling for barely a third of its peak price, many of those companies remain under financial pressure and all have cut back on drilling for new resources.

Heitkamp, who sat at the head table of an API event the week she took office, hailed the energy deals in the budget.

“This deal to lift the 40-year old ban on exporting oil is a huge win for North Dakota and it reinforces the importance of good-faith, bipartisan negotiations and legislating,” she said in a statement.