Sayyiduna Imran bin Husayn (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) said, when this matter came before him: "Had I known, I would not have offered his funeral prayer." In the narration of Jarir bin Hazim it is that he (peace and blessings be upon him) freed one third and kept the remaining two thirds in slavery; in another narration it is that he (peace and blessings be upon him) freed two and kept four in slavery, and this is what better fits the drawing of lots.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب العتق / 21407