BOSTON -- Secretary of the Commonwealth William Galvin on Wednesday threw his support behind a bill that would require presidential candidates to release their tax returns in order to appear on the Massachusetts ballot.

Galvin, a Democrat, testified before the Legislature's Joint Committee on Election Laws in favor of a bill sponsored by Sen. Michael Barrett, D-Lexington, that would require presidential candidates to release their tax returns and disclose their personal financial interests in order to appear on the ballot in Massachusetts. Candidates would have to release three years of tax returns to appear on the primary ballot and five years of returns to compete in the general election.

"The public policy of disclosure, of understanding conflicts of interest of individuals who would hold the highest office in the land, is fundamental to our democracy," Galvin said.

The bill, S 365, was filed in response to the 2016 presidential election, when President Donald Trump became the first major-party candidate in more than 35 years not to make his tax returns public.

Trump, a Republican, won 32 percent of the Massachusetts vote in the general election.

A similar ballot question has been proposed for 2018, which would institute a requirement that presidential candidates release six years of tax returns to the public in order to appear on the Massachusetts ballot.

The question was filed by Boston attorney Thomas Kiley, a former Massachusetts assistant attorney general. It was certified as constitutional by Attorney General Maura Healey on Wednesday.

Galvin urged lawmakers to take up the bill as soon as possible, since it would likely face a court challenge, and all issues would have to be resolved before the 2020 election.

Galvin called it "concerning" that, as Trump pushes for tax reform, no one knows how provisions he is proposing will affect him or his businesses.

By law, states cannot prescribe new qualifications for federal officeholders, but they can set conditions for ballot access -- for example, by requiring a certain number of signatures.

Several attorneys testified that the bill should be able to withstand legal challenges. Ben Clements, a Boston attorney and chairman of Free Speech for People, an advocacy group that aims to limit the influence of money in politics, said the bill would ensure voters have the opportunity to evaluate a candidate's potential for financial conflicts of interest.

"This president is plagued by financial conflicts of interest," Clements said.

Trump did file a financial disclosure form. But Barrett said that form was 104 pages long, while litigation has revealed that Trump's federal income tax filing is 12,000 pages. The tax returns could reveal far more detailed information about, for example, Trump's foreign business interests.

Jennifer Taub, a Northampton resident who co-founded the national "tax march" in April demanding that Trump release his tax returns, said Trump broke a 40-year bipartisan tradition.

"This law would allow the American people to once again follow the money," Taub said.

Gov. Charlie Baker, a Republican, did not take a position on the bill. "Governor Baker will carefully review any legislation that comes to his desk and as a candidate for governor released his own tax returns to the public," said Baker spokeswoman Lizzy Guyton.

Similar bills are pending in 24 states, although none have made it into law. New Jersey's Legislature passed similar legislation, but Republican Gov. Chris Christie vetoed it.