He was born in Córdoba, Spain when the area was under the control of the Moors (the Umayyad Caliphate). Perfecto was a monk and ordained priest. He served at the basilica of St. Acisclus in Córdoba. Christians were tolerated in the area, but not uniformly. According to his legend, in 850, Perfecto was challenged by two Muslim men to say who was the greater prophet: Jesus or Mohammed.
At first he refrained from responding, so as not to provoke them; but they insisted that he give them an answer, promising to protect him from reprisals. He then told them in Arabic that Muhammed was a false prophet and that he was an immoral man for supposedly seducing his adopted son's wife. The Muslims kept their promise and let him go, but several days later some of them changed their mind and had him arrested.
They had friends seize Perfecto (so as to not be forsworn) and tried. Perfecto was found guilty of blasphemy by the Islamic court and was executed. The legend says that Perfecto's final words were to bless Christ and condemn Muhammad and his Qur'an.
His martyrdom was one of the first in a period of Muslim persecution of the Christians in Al-Andalus, which began in 850 under Abd ar-Rahman II, continued under his successor Muhammad I, and went on intermittently until 960