Defense Secretary Pete Hegseth met with Prime Minister Benjamin Netanyahu on an unannounced visit to Israel on Monday. The trip happened as diplomatic efforts to end the war with Iran stalled. Hegseth also met with Israel Katz. Meanwhile, Netanyahu said, "Israel and the United States would never allow Iran to obtain nuclear weapons."

Defense Secretary Pete Hegseth traveled to the region as diplomatic efforts to end the war with Iran have stalled, two people with knowledge of the trip said. Israel will hold elections in a week.

Defense Secretary Pete Hegseth met with Prime Minister Benjamin Netanyahu on an unannounced visit to Israel on Monday, according to two people briefed on the meeting.

Mr. Hegseth made his trip a day after President Trump publicly endorsed Mr. Netanyahu, who is fighting for his political survival in a tough election campaign.

The Trump administration has expressed growing frustration in recent weeks as diplomatic efforts have failed to produce a lasting deal to end the war on Iran, and Mr. Trump has threatened to launch new strikes.

Mr. Hegseth also met with Israel Katz, Israel's defense minister, said the two people, who spoke on condition of anonymity to discuss private meetings.

The details of the conversations between Mr. Hegseth and his Israeli counterparts were not immediately clear. Mr. Netanyahu's office did not immediately respond to a request for comment.

Mr. Hegseth's trip to Israel and his meeting with Mr. Netanyahu was first reported by the news outlet Axios.

In late September, Mr. Trump suggested at the United Nations General Assembly that Washington could pursue renewed military action, and he threatened to "annihilate" Iran. This month, Mr. Trump said on social media that he would not launch a new attack before the midterm elections in November.

On Sunday, in a post thanking Mr. Trump for his endorsement, Mr. Netanyahu said that Israel and the United States would never allow Iran to obtain nuclear weapons.

Mr. Hegseth also visited troops with U.S. Central Command, which overseas American military operations in the Middle East. On Tuesday, he posted photographs of himself speaking with soldiers in front of a fighter jet but did not say where the visit took place or whether he had traveled to Israel and met with Mr. Netanyahu.

Some American soldiers and refueling aircraft have been stationed in Israel since the United States and Israel started the war by attacking Iran in late February.

The U.S. military has prepared new strike plans for Iran, including sending more forces to the Middle East, even as Mr. Trump has been inconsistent in his public messaging about the war.

Some analysts say they believe that the United States will most likely decide to strike Iran in the coming weeks or months, given how far apart the Trump administration and Tehran are in negotiations.

"The base line expectation in Iran, and in Israel, is that it's a matter of when the war restarts, not if," said Raz Zimmt, director of the Iran program at the Institute for National Security Studies, a Tel Aviv-based research group.

"An airstrike alone will probably not achieve the goals the U.S. and Israel hope to complete -- but it might give Trump an image of victory and a way out of the war," Mr. Zimmt added.

The Israeli election will take place on Oct. 27. Polls suggest that Mr. Netanyahu is trailing Gadi Eisenkot, a former chief of staff of the Israel Defense Forces under Mr. Netanyahu.