A groundbreaking measure to ban anonymous shell companies in the United States cleared Congress on Friday as the Senate joined the House in passing a defense-spending bill with a veto-proof margin.

The Corporate Transparency Act, which was tacked onto the defense bill, would require corporations and limited liability companies established in the United States to disclose their real owners to the Treasury Department, making it harder for criminals to anonymously launder money or evade taxes. The rule applies to future and existing entities alike.

The measure passed the Senate with an 84-to-13 vote as part of the National Defense Authorization Act, which cleared the House earlier this week. Trump pledged to veto the defense bill — one of few laws that passes every year — because it doesn’t include his demand to repeal liability protections for social media companies. Trump also opposes a clause that orders military bases named for Confederate leaders to be renamed.

The anonymous-shell-company ban was years in the making, as supporters slowly built a coalition of Democrats, Republicans, law-enforcement officials and even business groups that originally opposed the idea, such as the U.S. Chamber of Commerce.

“We are on the verge of celebrating the most significant anti-money-laundering victory in a generation due in large part to the widespread and growing support for reform,” said Clark Gascoigne, senior policy adviser at the FACT Coalition, an alliance of anti-corruption groups that helped push for the legislation.

Nearly 2 million corporations and limited liability companies are registered each year in the United States, at the state level. Few states today require companies to disclose their true owners, with Delaware and a few others turning the registration of anonymous companies into big business.

That’s one reason the U.K.-based Tax Justice Network has named the United States the globe’s second most financially secretive jurisdiction, behind the Cayman Islands and ahead of Switzerland.

Delaware Secretary of State Jeffrey Bullock last year endorsed the Corporate Transparency Act, calling it a “fair, bipartisan compromise” that would make it the federal government’s responsibility to collect the ownership data, which he said was better than a “piecemeal” state-by-state approach.

Tolerance of anonymous shell companies has long helped drug- and human- traffickers, organized crime groups and foreign kleptocrats launder their ill-gotten gains through the U.S. financial system, supporters of the legislation say. It took Michael Cohen, President Trump’s former lawyer, only a few days to set up and use an anonymous Delaware LLC to pay hush money to Stormy Daniels, in violation of campaign finance laws.

Rep. Carolyn B. Maloney (D-N.Y.), who introduced the legislation to the House in 2009, and continued resubmitting it each year, said U.S. shell companies have helped corrupt foreign leaders and criminals anonymously buy luxury real estate in her district, which includes Manhattan.

“If you drive through my district at night you will find a lot of apartment buildings with absolutely no lights on,” Maloney said during a news conference this week to mark the House passage. “They were purchased purely to hide money and act as a bank account.”

The law requires anyone registering a new company to disclose the name, address and date of birth of the real owners, and an identification number for each owner, such as a driver’s license or passport number. Corporations and LLCs that already existed before the law’s adoption must disclose their ownership information to the Treasury Department within two years.

Anyone willfully providing false information, including lawyers helping with corporate-registration paperwork, will be liable for fines of up to $10,000 and prison terms of up to two years.

The Treasury Department’s Financial Crimes Enforcement Network will collect the data and provide ownership details to law-enforcement agencies and banks upon request.

The legislation has limitations. The general public won’t have access to the ownership data, a disappointment to anti-corruption campaigners, who say public scrutiny would help combat criminal activity.

Bullock, the Delaware secretary of state, said these limits on access to the data were one reason the state supported the legislation.

In some cases, allied nations will be able to request ownership details to aid their own investigations, said Gary Kalman, director of the U.S. office of Transparency International, a big backer of the legislation.

In another transparency setback, the law also exempts some entities from the disclosure requirements, including domestic investment funds that are advised and operated by a registered investment adviser. Gascoigne said that exemption was the result of lobbying by the private-equity and hedge-fund sectors.

The database is likely to help prosecutors nationwide build cases against criminal groups, said Frank Russo, director of government and legislative affairs at the National District Attorneys Association.

The lack of such a database today is undermining efforts in Florida to combat human-trafficking networks at illicit massage parlors, Russo said.

Investigators “can’t figure out who is financing and paying for these operations” because the ringleaders hide behind anonymous shell companies, he said.

Sen. Sherrod Brown (D-Ohio), a key backer of the Senate bill, along with Sen. Mike Crapo (R-Idaho) and others, said shell companies have enabled everything from sex trafficking to fentanyl pushers in his state.

“This is a really big deal to get this passed, and as you know it took a long time,” Brown said during the news conference Thursday, adding that he hoped Republican senators would “stand strong” and vote to override any Trump veto, if necessary.

The banking industry became an important supporter of the legislation in recent years, after realizing it would help banks identify the real owners of all accounts, as required under Obama-era regulation.

The legislation will give banks access to the Treasury ownership database to verify information on new customers requesting accounts.

Other developed nations are also cracking down on anonymous shell companies, responding to fears about terrorist financing, and public outrage about corruption and tax evasion. The European Union instructed all member countries to create public databases by 2020 that disclose companies’ true owners. Britain mandated the same in 2016.