President Trump shakes hands with Rex Tillerson as Tillerson is sworn in as secretary of state on Feb. 1.

Long before Rex Tillerson made the rounds on Capitol Hill this winter to convince senators to confirm him as secretary of state, he took a trip to the Hart Senate Office Building to meet with then-Sen. Richard Lugar of Indiana regarding a provision the senator wanted added to a 2010 bill that would affect how tight-lipped oil companies are allowed to be about business dealings.

Lugar, the top Republican on the Senate Committee on Foreign Relations at the time, was pushing to make into law an anti-corruption rule that would force companies that extract oil, gas, and other resources in the ground around the world — ones like ExxonMobil, the largest US energy company — to disclose how much money they paid nations for the right to drill and pump.

During the half-hour meeting, Tillerson made his company’s case for why the rule should not be put in place. Among his reasons were that such disclosures would hurt Exxon’s budding relationship with Russia, two staffers who worked for Lugar told BuzzFeed News.

Tillerson ultimately did not persuade Lugar, who along with his Democratic colleague on the foreign affairs committee, Sen. Ben Cardin of Maryland, enacted into law in 2010 that anti-corruption provision, now known as the Cardin–Lugar rule. The rule was included in the Dodd–Frank Act that rewrote Wall Street regulations, which was passed by a Democrat-controlled Congress and signed into law by President Barack Obama.

But Exxon and its allies in Washington were not deterred. The US oil industry mounted a seven-year effort to delay the law from being put into effect that included suing the Securities and Exchange Commission.

That stalling is about to pay off. With Republicans in control of both the White House and Capitol Hill this year, the stars have aligned for Exxon to do away with the rule entirely, just in the nick of time.

“Exxon has been fighting against this legislation for a very long time despite paying lip service to transparency,” Jana Morgan, US director of the nonprofit coalition Publish What You Pay, told BuzzFeed News.

On Wednesday, the House of Representatives voted to strike the rule after the SEC in 2016 published a finalized version of it. Then on Friday, the Senate voted to kill the rule as well.

Now it just needs Trump’s signature to become law.

“Today’s House vote is a necessary step by Congress to establish sensible regulations that balance increasing transparency without diminishing our industry’s competitive advantage,” Stephen Comstock, director of tax policy at the American Petroleum Institute, said in a statement applauding the House vote Wednesday.

In developing countries rich in oil but poor in business expertise, governments must partner with the US or other Western oil companies to lay pipelines and run rigs. But often, these countries are unable to manage the newfound wealth and sometimes through the signing of bad deals with foreign drillers, they fall victim to the so-called resource curse. Such transparency requirements in oil and gas payments were meant to shed light on potential bribery and other corruption.

The main issue that the API, the US oil and gas industry’s main lobbying arm in Washington, took with the law was that it put US firms at a disadvantage compared to foreign (often state-owned) peers who were not subject to such stringent disclosure requirements.

But some oil industry critics, including Morgan, argued that because the EU and Canada had passed their own versions of the transparency rule since 2010, multinational energy companies are already subject to much disclosure about its foreign operations.

Under the Cardin–Lugar provision, the SEC was tasked with writing a final version of the rule. In 2012, API, along with the US Chamber of Commerce, sued the SEC to try to overturn the underlying law.

Over the course of the lawsuit, the trade association argued that some foreign laws did not allow disclosure and that even under the US legal system, such reporting violated companies’ First Amendment rights.

API failed to undo the law in court, and the SEC proceeded. “Unfortunately, the SEC largely ignored industry’s comments,” William Holbrook, an Exxon spokesperson, told BuzzFeed News.

But the lawsuit had the effect of slowing down the SEC’s rule-making process. In 2013, a judge ruled that the SEC had to go back and justify the way it wrote the rule.

Not every US oil firm agreed with API’s position. For example, Kosmos Energy, a small Texas oil firm that fought over the size of payments it was required to make to the government of Ghana, supported the transparency rule.

But Exxon, as the largest US oil and gas company, holds the most sway over decision-making at API. Just as Dodd–Frank Act became law in 2010, Exxon was putting together a massive $500 billion deal with Rosneft, a state-owned oil company in Russia, to drill in the Arctic. Sanctions the Obama administration put on Russia for annexing Crimea and using force in east Ukraine — ones that Trump has suggested he may lift — have put the Exxon-Rosneft deal on pause.

After the court ruling, the SEC dragged its feet to redo its work. Only after yet another lawsuit was filed against the SEC, this time by anti-poverty group Oxfam, did the commission publish notice of the finalized rule — in June 2016.

But that years-long delay was enough to put the Cardin–Lugar rule in the crosshairs of Republicans in Congress in 2017. Wielding a once little-used law called the Congressional Review Act, Congress can strike down recently enacted regulations with a simple majority in the both chambers — meaning Democrats can’t block the repeal with the filibuster in the Senate.

Congress did just that with the votes this week.

“It should be lost on no one that in less than 48 hours the Republican-controlled Senate has confirmed the former head of ExxonMobil to serve as our Secretary of State, and repealed a key anti-corruption rule that ExxonMobil and the American Petroleum Institute have erroneously fought for years,” Cardin said in a statement.

Holbrook, the Exxon spokesman, said the company is committed to transparency in its foreign dealings. “We believe that the best approach would be to adopt a rule consistent with Extractive Industries Transparency Initiative principles,” he said, citing a global transparency standard that Exxon has voluntarily adopted.

Exxon and API want regulations that require the disclosure of foreign payments at only the country-by-country or region-by-region level. Citing an API letter to the SEC, Exxon argues that the commission’s rule required disclosure “so granular as to reveal proprietary commercial information.”

But others involved in the Extractive Industries Transparency Initiative in the US say there was a way for Exxon to support the initiative — by backing the Cardin–Logan rule.

“They get to say they support transparency,” Mia Steinle, investigator of Project on Government Oversight and civil society coordinator for the Extractive Industries Transparency Initiative in the US, told BuzzFeed News. “But at the same time they’re fighting the SEC and fighting Congress to stop the rules that would be enforcing it.”