Iraq Threatens War with Turkey

Middle East Map

Iraq warns that it will take military action against Turkey if they do not withdraw their troops from their territory. This would get complicated since Turkey is a member of NATO. So who is on whose side? Is Turkey just abusing its NATO status to attack Russia for seven seconds of violating its air space when it has invaded a neighbor itself?