ALBANY, N.Y. -- New York lawmakers gave final passage to legislation Wednesday that would allow President Donald Trump's state tax returns to be released to congressional committees that have, so far, been barred from getting the president's federal filings.

The Democrat-led Senate and Assembly both approved the measures Wednesday, sending them to Gov. Andrew Cuomo, a Democrat. A spokesman has said the governor supports the principle behind the legislation but will review the bill carefully before deciding whether to sign it.

The legislation doesn't target Trump by name, but it would allow the leaders of the U.S. House Ways and Means Committee, the Senate Finance Committee or the Joint Committee on Taxation to get access to any New York state tax returns filed by elected officials and top appointed officials. The legislation would apply to personal income tax returns, as well as business taxes paid in New York.

An earlier version of the proposal that passed the state Senate two weeks ago would have allowed congressional committees to get any New Yorker's returns, regardless of whether they held public office. Lawmakers later narrowed the legislation to address concerns that it went too far, prompting the Senate to hold a second vote on the new language Wednesday.

New York Republicans have railed against the bill. John Flanagan, who leads the Senate GOP, called the legislation "troubling" and "bad public policy."

Fellow GOP lawmakers said the new proposal's narrower focus shows Democrats went too far with their first proposal, which would have required state tax officials to hand over any New Yorker's state tax returns.

"This bill is nothing more than political showmanship, and we all know it," said Assembly Andrew Goodell, who represents a mostly rural western New York district.

Republicans also blasted Democrats for going after the president instead of focusing on challenges closer to home.

"The fact that we're talking about taxes in this house is ironic because we're not talking about the taxes that New Yorkers pay, which are the highest in the nation," said Rob Ortt, a senator from the Buffalo area.

But the proposals' Democratic sponsors -- Sen. Hoylman, of Manhattan, and Assemblyman David Buchwald, of Westchester County -- said the legislation promotes government transparency at a time when Americans need to know whether their elected leaders are putting the public's interest first.

"We are affirming Congress' role as a co-equal branch of government and the sacred constitutional principle that nobody is above the law, not even the highest elected official in the land," Hoylman said.

The proposed changes to state law were made amid a battle going on in Washington over Trump's federal returns.

Democrats are seeking six years of Trump's personal and business tax returns to aid a committee investigation into whether the IRS is doing its job properly to audit a sitting president and whether the law governing such audits needs to be strengthened.

Treasury Secretary Steven Mnuchin has said he wouldn't comply with a congressional subpoena seeking six years of Trump's tax returns, in part because the request "lacks a legitimate legislative purpose." U.S. Rep. Richard Neal, D-Mass., chairman of the House Ways and Means Committee, has threatened to go to court to get the administration to comply.

New York is Trump's home state and headquarters of many of his business enterprises. Much of the information on his state returns would mirror the information included on a federal return, giving the Democrats a potential end run around the IRS if they wished to take it.

If Congress does request and obtain Trump's state tax returns, that doesn't mean the public gets to see them. Under federal law, the confidential information in the returns is supposed to be for the committee's eyes only.

The New York bills have no time limitation on the tax filings that could be shared with Congress. They require that the returns be requested "for a specified and legitimate legislative purpose," wording that could ostensibly give state officials the ability to refuse some requests they felt were primarily political in nature.

The New York bills would become law immediately upon being signed by Cuomo, though it could be delayed by a court challenge.

Passage of the legislation came just a few hours before a federal judge in Manhattan refused to block congressional subpoenas seeking financial records from two banks that did business with Trump.

The judge said subpoenas from lawyers for the House Financial Services and Intelligence committees have "a legitimate legislative purpose" in their investigation into Trump, his family and his company's dealings with Deutsche Bank and Capital One.