For more than three years AQAP and Muhammad bin Nayif have been involved in a high-stakes intelligence duel, which has largely been fought in the shadows of Yemen's tribal territories.
Shortly after AQAP formed in January 2009 one of the group's top leaders, Muhammad al-Awfi a former Guantanamo Bay detainee defected back to Saudi Arabia, surrendering to Saudi intelligence.
Months later AQAP used that defeat to as a model for one of its suicide bombers, Abdullah Asiri, to gain access to Muhammad bin Nayif. Posing as someone who wanted to surrender to Saudi intelligence like al-Awfi, Asiri arranged a meeting with bin Nayif. At the meeting, Asiri's bomb was detonated when the prince was standing next to him. Miraculously, bin Nayif escaped with only light injuries.
Then, in late 2009, AQAP managed to put a suicide bomber on a plane bound for the US. The would-be bomber was a Nigerian student who had joined the group only months earlier. The bomb malfunctioned and the Nigerian was arrested in Detroit.
Now, it appears Saudi intelligence has used that model to infiltrate a double agent into AQAP's ranks. (See this amazing story from Scott Shane and Eric Shmitt of the New York Times.) Again an outside member - presumably with a US visa or the possibility of acquiring one - approached AQAP just like Umar Farouk Abdu Mutallab the would-be Nigerian bomber, and convinced the group to give him AQAP's latest bomb, which some have described as the "Christmas bomb, the next generation."
----- One concluding note, much of the reporting has focused on Fahd al-Qusa being named AQAP's head of foreign operations to replace Anwar al-Awlaki, who was widely believed to have held that role. This is certainly possible, but since it is important to examine other possibilities I thought I would propose an alternative theory - a bit of red-teaming this, if you will.
What if instead of being the head of foreign operations, Qusa was simply the head of the cell that the double agent managed to infiltrate? This would explain the US' apparent uncertainty about whether or not there might be more bombs. It would also explain why Qusa was killed but Asiri was not - maybe the double agent never met Asiri. He does, however, appear to have been in contact with Qusa, who was killed over the weekend in a drone strike.
Not sure how likely this theory is, but it is one possible explanation.