A New Zealand man has been sentenced to more than three years in prison for distributing terrorist videos in the first case of its type in the South Pacific nation.

After his sentencing on Thursday, 26-year-old Imran Patel had to be dragged by security guards from an Auckland courtroom while he shouted "Allahu akbar," the Arabic phrase for "God is great," according to The New Zealand Herald newspaper.

Patel pleaded guilty this year to distributing objectionable material after sending out links to videos made by the Islamic State group that depicted prisoners being shot and beheaded.

Judge Russell Collins said the violence shown on the videos was "grotesque." The Herald says defense lawyer Adam Holland said his client was "naive and misguided" and assumed he was doing nothing wrong.