The remark by Brig. Gen. Pakpour was prompted by rising activity of the Daesh* terrorist group in Iraq's northern Kirkuk governorate.
On Sunday, members of the terrorist group killed 12 in an attack on the federal police in the village of Tal al-Steih.
"Given the growing threat from terrorist and armed groups in Kurdistan, in northern Iraq, as well as growing instability at the Iranian border, I declare that Iran will not tolerate it and will give a necessary and strong response," Pakpour told the national IRIB broadcaster.
"Do not turn your territory into the arena for terrorists ... I reiterate, in case of necessity, we [Iran] will attack."
In late 2017, the Iraqi authorities claimed victory over Daesh in the country. However, the Iraqi army keeps carrying out raids against the militants and "sleeper cells" of terrorist groups nationwide.
*Daesh (also known as ISIS/ISIL/IS) is a terrorist organization outlawed in Russia and many other states.