TEHRAN — Iran’s president said on Tuesday that he simply would not allow President-elect Donald J. Trump to tear up last year’s nuclear agreement and warned of unspecified consequences if he did.

“He wants to do many things,” Iran’s president, Hassan Rouhani, said of Mr. Trump in a speech. During the campaign, Mr. Trump called the nuclear agreement “a bad deal” that he promised to “tear up.”

“He wants to undermine the J.C.P.O.A.,” Mr. Rouhani said, referring to the agreement, the Joint Comprehensive Plan of Action. “He wants to tear up the J.C.P.O.A. Will we or our nation allow this?”

As Mr. Rouhani posed the question, the audience began chanting, “Death to America.”

In the speech, which was delivered at Tehran University and televised nationally, Mr. Rouhani maintained that “America cannot influence our determination, this nation’s resistance and its struggle.”