WASHINGTON — Democrats are preparing to use an obscure law to try to obtain a copy of President Trump’s tax returns if they win control of the House or Senate — a scenario that could force one of the president’s most trusted aides to reveal his most closely guarded secret.

Steven Mnuchin, the Treasury secretary, said in an interview that he would honor any legal requests from Congress to release the president’s tax returns, which are stored in a vault at the Internal Revenue Service. But the demand would undoubtedly thrust Mr. Mnuchin into the fraught position of balancing his loyalty to Mr. Trump with a legal requirement to deliver the returns.

“The first issue is they would have to win the House, which they haven’t done yet,” Mr. Mnuchin said during an interview in Jerusalem last week. “If they win the House and there is a request, we will work with our general counsel and the I.R.S. general counsel on any requests.”

Mr. Mnuchin said his team would analyze any demands for the president’s returns and fulfill them if required by law. Asked whether a request made for political purposes would be legal, Mr. Mnuchin demurred, saying he did not want to stake out any legal positions. His team has not yet studied the issue, he said.