Secretary of Defense James Mattis testifies before a Senate Armed Services Committee hearing on the "Political and Security Situation in Afghanistan" on Capitol Hill in Washington, October 3, 2017.

U.S. Defense Secretary James Mattis on Tuesday said it would not be in the country's national security interest for President Donald Trump to abandon the Iran nuclear deal.

The secretary's assessment marks one of the strongest public defenses of the deal by an administration official in recent weeks. Trump has lately begun hinting that he may soon take steps to leave the landmark 2015 accord, which put limits on Iran's nuclear program in exchange for sanctions relief.

The White House is approaching an Oct. 15 deadline, when Trump must either certify to Congress that Iran is complying with the deal or give lawmakers the choice to reimpose sanctions.

Mattis weighed in during a Senate Armed Services Committee hearing on Afghanistan after being prompted by Sen. Angus King, an independent from Maine.

"Do you believe it's in our national security interest at the present time to remain in the JCPOA?" King asked, referring to the deal's official title, the Joint Comprehensive Plan of Action.

"Yes, Senator, I do," Mattis replied.