Treasury Secretary Steve Mnuchin said Tuesday that there could be good reasons for shutting down the government, echoing a statement President Trump made in a Tweet in May.

Mnuchin was asked a direct question about Trump's tweet earlier this year that "Our country needs a good 'shutdown' in September to fix mess!'"

Trump made the remarks after a spending deal was reached to fund the government through September. Many outside observers wrote that Democrats got the better of Trump in that negotiation. Republicans had feared they would be blamed for a shutdown.

"It's an unfortunate outcome," Mnuchin said of a shutdown when Sen. Tim Kaine (D-Va.) asked what a good shutdown would comprise during a Senate Budget Committee hearing on Tuesday.

"At times there could be a good shutdown, at times there may not be a good shutdown," Mnuchin said. "There could be reasons at various times why that is the right outcome."

Mnuchin specified that a shutdown was not the administration's primary objective, and said that critical infrastructure would not be shuttered.

If the government fails to pass a budget resolution and spending bills by the end of September, the government will not have legal authority to spend money and operate. Congress will also need to raise the nation's borrowing limit in the coming months.

In 2013, the government shut down for over 2 weeks in an impasse over spending levels and the debt ceiling.