Jundub b. ‘Abdallah al-Bajali reported God’s Messenger as saying, “If anyone sacrifices before the prayer, he must sacrifice another animal in place of it; but anyone who does not sacrifice till we have prayed must then sacrifice in God’s name."
(Bukhari and Muslim.)