A military court found a New Zealand soldier guilty of attempted espionage for a foreign power on Monday — the first spying conviction in the country's history.

The soldier was caught offering to pass military base maps and photographs to an undercover officer posing as an agent for a third country, the court-martial heard.

The man's name, the country he attempted to spy for and the name of the undercover officer who caught him were all suppressed by the court.