Muawiyah bin Al Mugheerah aided the pagans by spying on the Muslims. He was granted three days to leave the area where the Muslim community lived. Three days later, he was still in Madinah collecting info for the idolaters of Makkah so they use that information to attack the Muslim community. So the Prophet had him killed.
Here, we see Prophet Mohammed (p) showing mercy to this enemy by giving him three days to leave and cease spying, yet after the days passed he was still in Madinah. He was killed for it.
A Makkan spy, called Mu’awiyah bin Al-Mugheerah bin Abi Al-As, was sentenced to death too. This spy was the grandfather of Abdul Malik bin Marwan on his mother side. When the idolaters went back after Uhud, Mu’awiyah came to his paternal cousin Uthman bin Affan. Uthman gave him shelter – after securing the Prophet’s permission – on condition that if he was caught there after three days, he would be killed.
But he did not comply with it, so when the Muslim army left Madinah, he stayed there for more than three days during which he was spying for Quraish. So when the army returned, Mu’awiyah fled out of Madinah. The Messenger of Allah (p) ordered Zaid bin Harithah and Ammar bin Yasir to pursue him and kill him. So he was killed. 
MOAVIA IBN MUGHIRA
Moavia Ibn Mughira, also a prisoner of war, was granted three days truce, on the condition that if he were found in Medina after the appointed time, he was to be executed. The period had passed and he was still lurking at Medina. At length he was found out and killed by Zeid and Ammar on their return from Hamra-al-Assad, after five or six days. It is apparent that Moavia violated his truce and his lurking in might be either as a spy or scout secretly seeking information. 
 The Sealed Nectar By Safiur-Rahman Mubarakpuri, page 291 – 292
 A Critical Exposition of the Popular Jihad (Original 1885) – Cheragh Ali page 81 – 83