Elmo hired barney to do the deed cause he was tired of cookie monster making a mess in his house,big bird,the guy having the standoff with cookie monster,didn't even shoot,and was a distraction.for barney to snipe c,m.yes,this was all an elaborate plan by Elmo,cause it turns out he was a former war criminal
(this is the canon lore/end for cookie monster.)