James Shaw's attacker sentenced to prison

The man who attacked Green Party co-leader James Shaw has been sentenced on Wednesday.

He's been sentenced to nine months in jail with leave to apply for substitute sentence, meaning he can apply from prison for home detention.

The Climate Change Minister was punched in the face on March 14 while on his way to Parliament, sustaining a fracture to his eye socket.

Shaw told ministerial colleagues the attacker was yelling about the United Nations. New Zealand supported a controversial United Nations migration pact which was vociferously opposed.

A 47-year-old Wainuiomata man plead guilty to the attack in May, and was given name suspension after his lawyer argued naming the man would cause hardship to himself, his family and his business.

MPs have been subjected to all sorts of attacks over the years, but rarely as violently as this. New Zealand First leader Winston Peters confirmed that he has received threats before, and National deputy leader Paula Bennett said also said she's been threatened.

"Probably about three occasions come to mind where I felt like I could have been physically hurt."