In 624 Abu al-As fought in the Battle of Badr on the side of the Quraysh and was captured by Abdullah ibn Jubayr al-Ansari. Zaynab sent a ransom for him via his brother Amr, including an onyx necklace that had been a wedding present from Khadija. At the sight of the necklace, Muhammad remembered Khadija and was moved. He sent Abu al-As back to Mecca without taking any of the ransom, on condition that Zaynab be sent to Medina. Hence Abu al-As was separated from Zaynab for the next four years. In her absence, he wrote poetry for her: