Defence Minister Gerry Brownlee's supposedly top-secret visit to Israel was blown after Israel's defence Minister posted about a meeting with Mr Brownlee on his Facebook page.
Mr Brownlee is on an unannounced visit to Israel after his visit to Taji Military Camp in Iraq last week. It was supposed to be kept under wraps for what his office said were security reasons.
However, Israel's defence Minister Moshe Ya'alon posted a photo and wrote about their meeting on Facebook, saying despite the distance between the two countries they had a lot in common. He said Mr Brownlee had also asked about a picture on his wall of the Israeli Air Force flying over Auschwitz.
A spokeswoman for Mr Brownlee said the trip was kept secret for "security reasons" and declined to comment on the details of that trip until it ended tomorrow.
"Defence Minister Gerry Brownlee is currently wrapping up his first visit to Egypt and Israel, where he carried out bilateral meetings with his ministerial defence counterparts."
It is not the first time a "secret" trip has been scuppered by foreign politicians - Iraq's Prime Minister Haider al-Abadi put photos of himself and Prime Minister John Key on his Facebook page while Mr Key was still in Iraq visiting troops last year.
That mishap was partly because delays in Mr Key's travel meant he was in Iraq longer than expected.
The reasons for the Defence Force's insistence on secrecy for Mr Brownlee's Israel trip are less clear.
Similar secrecy has not applied to visits to Israel by Foreign Minister Murray McCully, who visited in 2015 as part of his efforts to get a Security Council resolution on the Middle East peace process, and did media interviews while in Israel.
Israel has been critical of New Zealand for trying to spearhead that process and it was put on ice until Mr McCully recently revived it.
It is understood Mr Brownlee's visit was not related to that effort. Mr Brownlee's visit came after Mr McCully repeated his criticism of Israel for land occupations in the occupied Palestinian territories, which he said threatened the viability of the two-state solution.