During a hearing before the Senate Armed Services Committee, Sen. Angus King asked Mattis: "Do you believe it is in our national security interest at the present time to remain in the (Joint Comprehensive Plan of Action)? That is a yes or no question."
"The point I would make is if we can confirm that Iran is living by the agreement, if we can determine that this is in our best interests then clearly we should stay with it," Mattis added. "I believe at this point in time absent indications to the contrary, it is something the President should consider staying with."
But Mattis went on to explain that he also supports a rigorous review of national security issues related to Iran that may fall outside the exact terms of the agreement.
"The President has to consider more broadly things that rightly fall under his portfolio of looking out for the American people in areas that go beyond the specific letters of the JCPOA -- in that regard I support the rigorous review that he has got going on right now," he said.
Chairman of the Joint Chiefs of Staff Gen. Joseph Dunford also reiterated his stance on the Iran deal during Tuesday's hearing.
"Iran is not in material breach of the agreement, and I do believe the agreement to date has delayed the development of a nuclear capability by Iran," he said.
Trump has repeatedly criticized the Iran deal, most recently during his address to the United Nations General Assembly last month.
"We cannot let a murderous regime continue these destabilizing activities while building dangerous missiles, and we cannot abide by an agreement if it provides cover for the eventual construction of a nuclear program," Trump told the assembly.
The President and administration officials have said the deal doesn't address Iran's missile development or its activities in the region, including support for Houthi rebels in Yemen and for the regime of Syria's Bashar al-Assad. Money flowing to Iran because of sanctions relief is allowing Tehran to fund these destabilizing activities, the administration argues.
During his own address at the UN General Assembly
, Iranian President Hassan Rouhani said it would be a "great pity" if "rogue newcomers" destroy the international nuclear deal that lifted sanctions in exchange for curbs on Tehran's nuclear program.
"It will be a great pity if this agreement were destroyed by rogue newcomers to the world of politics," he added in a clear reference to US President Donald Trump, who addressed the General Assembly the day before.
"I declare to you the Islamic Republic of Iran will not be the first country to violate the agreement, but it will respond decisively and resolutely to its violation by any party," he said.
At the UN last month, the European Union's foreign policy chief, Federica Mogherini, made clear that European parties to the deal aren't interested in revisiting the agreement, which took two years to finalize.
"There is no need to reopen the agreement because it's fully delivering" and Iran is abiding by it, Mogherini said. "This is an agreement that prevented a nuclear program and potentially prevented a military intervention," Mogherini said. "Let's not forget that."
She said that, "it's not for one party or the other to certify this." That's a job for the International Atomic Energy Agency, "with its technical independent role" to verify that Iran is sticking to the agreement.
Trump told reporters at the UN that he had made a decision about how to proceed when he next has to certify in mid-October that Iran is in compliance.