WASHINGTON (AP) — Over the protests of many Democrats, the Senate on Wednesday evening approved President Donald Trump's choice to become the new head of the IRS. Democrats opposed the nomination because of a new Trump administration policy allowing some groups involved in politics to hide their donors' identities.

The Senate voted 64-33 to confirm Beverly Hills tax attorney Charles Rettig as Internal Revenue Service commissioner. Democrats who voted against him did so even though they considered him qualified for the job. Still, 15 Democrats voted with the Republicans to approve Rettig.

With the midterm elections barely two months away, critics say the new policy announced by the IRS in July will let more dark money — including from foreign interests — flood into the U.S. political system. The policy lifted donor disclosure requirements for thousands of groups, including those spending millions on political ads.

Groups that will benefit include so-called social-welfare organizations, business leagues and labor unions. Among them are sections of the U.S. Chamber of Commerce, the National Rifle Association and a group linked to the billionaire Koch brothers.

The Democrats say that although Rettig is qualified for the position, they needed to register their concern over the new IRS policy. Sen. Ron Wyden of Oregon, the senior Democrat on the tax-writing Senate Finance Committee, said he asked Rettig to commit to changing the new rule, without result.

"He wouldn't even acknowledge that there is a real problem here for the cause of transparency and openness in our democracy," Wyden said in remarks on the Senate floor before the vote.

"So over the next two months, while political ads flood the airwaves, millions of Americans are going to wonder how much of this stuff is paid for by lawbreaking foreigners and special interests," Wyden said. "Because of the new rule, the IRS and law enforcers are going to be in the dark, too. ... This is as corrupt as anything I know of before the United States Senate."

News of the IRS policy change this summer came the same day federal prosecutors charged a gun-rights activist living in Washington with serving as a covert Russian agent gathering intelligence on U.S. officials and political organizations. Court papers show that the activist, Maria Butina, made efforts to use contacts with the National Rifle Association to develop relationships with U.S. politicians during the 2016 campaign.

The revelations of alleged Russian efforts to use the NRA as a conduit into political influence, coming soon after Trump's summit with Russian President Vladimir Putin, stoked the Democrats' furor over the IRS action as part of a string of related events.

Rettig faces the challenge of administering the sweeping $1.5 trillion tax law enacted by Republicans in Congress in December, which became Trump's signature legislative achievement.

Senate Finance Committee Chairman Orrin Hatch, R-Utah, said Rettig also is expected to work to modernize the IRS' outdated technology.

"With the biggest tax overhaul in a generation on the books, it's about time that the agency charged with administering our nation's tax laws has a confirmed commissioner," Hatch said Wednesday. Trump named Rettig nearly eight months ago, and an acting commissioner has filled the role.

As a tax attorney, Rettig has represented thousands of individuals and companies in civil and criminal tax matters before the IRS and against it in court. His clients have included affluent taxpayers seeking to strike deals with the IRS to turn over information on offshore bank accounts in exchange for reduced penalties.

During the 2016 campaign, Rettig defended Trump's decision to break with tradition by refusing to release his personal tax filings. At his confirmation hearing last month, Rettig pledged to uphold the political independence of the IRS.

Opposition from some Democrats also stemmed from another new IRS rule aimed at preventing residents in high-tax states from avoiding a new cap on widely popular state and local tax deductions. The action under the new Republican tax law pitted the Trump administration against high-tax, heavily Democratic states.

That rule targets moves by states like New York, New Jersey and California — where residents could see substantial increases in their federal tax bills next spring because of the $10,000 cap on state and local deductions. The cap was put in as a compromise to eliminating the deductions completely, as part of the massive GOP tax package. Experts say the issue likely will have to be resolved by the federal courts.

On the Senate floor, Sen. Bob Menendez, D-N.J., called the move "one giant hit job on New Jersey's middle class."

The Democrats voting to approve Rettig were Sens. Michael Bennet of Colorado, Sherrod Brown of Ohio, Ben Cardin of Maryland, Bob Casey of Pennsylvania, Catherine Cortez Masto of Nevada, Joe Donnelly of Indiana, Maggie Hassan of New Hampshire, Heidi Heitkamp of North Dakota, Doug Jones of Alabama, Patrick Leahy of Vermont, Joe Manchin of West Virginia, Claire McCaskill of Missouri, Christopher Murphy of Connecticut, Brian Schatz of Hawaii and Jeanne Shaheen of New Hampshire.