In a two-year mission likely to start in May, New Zealand personnel will train Iraq security forces at the Taji Military Complex north of Baghdad, Key said. He said soldiers would provide protection for the training force.
Key said ISIS -- also known as the Islamic State of Iraq and the Levant (ISIL) -- posed a threat to stability in regions beyond the Middle East and New Zealand had "an obligation" to help support the rule of law internationally.
"New Zealand is a country that stands up for its values. We stand up for what is right," he told parliament.
"We do not shy away from taking our share of the burden when the international rules based system is threatened as it is today."
Key said attacks in Ottawa, Sydney and Paris had underscored the risk of complacency. "To those who argue that we should not take action because it raises the threat, I say this 'the risk associated with ISIL becoming stronger and more widespread far outweighs this.'"
In a statement
, Key referred to New Zealanders as "prolific travelers" who were not immune from the risk posed by ISIS. "ISIL's brutality has only worsened and its outrageous actions have united an international coalition of around 62 countries to fight and degrade the group," he said.
Opposition leaders were quick to condemn the decision, which they said should have been debated and voted on in parliament.
Labour leader Andrew Little said
his party was opposed to sending troops to Iraq and that it was unlikely they would remain behind the front line.
"The Prime Minister says they will be behind the wire but we know they will not be. They cannot stick there, they cannot stay there, that is not all they will do. They will not just be behind the wire; they will be exposed to the much wider conflict; it will not be just the soldiers we send to the Iraq, it will be Kiwis traveling around the world," Little said.
Green Party Leader Russel Norman said
Key was "dragging New Zealand into someone else's war without a mandate" and was making the country and its citizens unnecessary targets for ISIS.
New Zealand First leader Winston Peters s
aid Key had made a "giant turnaround" since ruling out a troop deployment. "Nothing has changed in Iraq, except 'his club' persuaded Mr Key to commit our troops," Peters said in a statement.
'Not taken lightly'
Key said the government had carefully considered New Zealand's contribution to the coalition.
"A training mission like this is not without danger and this is not a decision we have taken lightly," he said. "I have required assurances that our men and women will be as safe as they can practicably be in Taji.
The deployment came at the request of the Iraqi government and was likely to be a joint training mission with neighboring Australia, Key said. New Zealand's cabinet would review the deployment after nine months, he added.
The United States is leading the coalition to fight ISIS from the sky over Iraq and Syria. The militant group has declared an Islamic caliphate
in the area and demanded that all Muslims pledge allegiance to its leader -- Abu Bakr al-Baghdadi.
Richard Jackson from the National Centre for Peace and Conflict Studies at New Zealand's University of Otago
said New Zealand's commitment to the coalition would likely be dangerous for its citizens in the Middle East region.
"There is definitely a risk in joining the international effort and that risk is first of all that New Zealand personnel in the region will become a more identifiable target," he told CNN.
"The secondary risk is that New Zealand involvement in the international effort will radicalize people in New Zealand and or Australia. I think that's a very small risk because I don't think there are many potential extremists in New Zealand."
ISIS did not directly pose a threat to NZ domestically, Jackson said.
"The only influence they have is an indirect one. If they start showing pictures of civilians killed by Western b