To clarify the moment of his Transformation the portrayal of the historical Jafar Ibn Yahya as well in written fiction and film needs to be examined.
Jafar Ibn Yahya* as a historical character. He was well regarded for most of his life but fell from favour after 799 AD after which in 803 AD Haroun al Rashid ordered his execution.
Your excellent reference details his life, his times and unfortunate demise and hints at the reasons for this.
Outside of the 1001 nights Jafar has been variously portrayed and influenced works of fiction but these are not relevant to our discussion which centres on Jafar’s role of treacherous villain in relation to the Aladdin story.
In relation to written fiction lying within the compass of the 1001 nights he appears in numerous tales. In the two that you mention (1. When at night and incognito Jafar accompanies Haroun Al Rashid to gatecrash a party involving three ladies and a porter see here and 2. the three apples story – which -rather than being a triumphant exposition of detective work – has Jafar do little other than agonize over Caliphs likely disapproval at his own lack of progress on the case (( which stretches for some days!)) until he is saved by a serendipitous chain of events).
It is highly significant that neither Jafar, nor Haroun Al Rashid appear in the Tale of Aladdin, which in addition includes a Sultan (not Haroun Al Rashid), his daughter (Lady Badr Al Budur) and a Wazir (Not Jafar) who doubles as a Moorish Magician. Jafar is conspicuously absent from this tale.
- Jafar in his role on the silver screen. English Language films germane to understanding the evolution of Jafar’s metamorphosis include Aladdin and his wonderful Lamp 1917, Thief of Baghdad 1924, Thief of Baghdad 1940, and Disney’s Aladdin 1992.It should be noted all these movies diverge from the plot compared to the printed medium.
Aladdin and his wonderful Lamp 1917, (directed by the brothers Sidney & Franklin Chester) can be viewed at this site. With child actors, featuring an evil magician Al- Talib who aspires to the princess’ hand, but no Jafar.
Thief of Baghdad (1924) is another Aladdin movie of the silent era the film is viewable here in its entirety. A synopsis with dramatis personae appears in this helpful online article. From these it is evident that Jafar is conspicuously absent, our hero (Aladdin ) has been renamed Ahmed Abdulla. In the later part of the film an evil magician- not named Jafar- is a henchman of a Mongol prince (who is a suitor of princess of Baghdad) makes an appearance.
The identically titled Alexander Korda movie from 1940 has naïve King Ahmed who is imprisoned by Jafar (a villainous vizier& scurrilous sorcerer), with the help of a thief (Abu) they escape to Basra pursued by Jafar where Ahmed Falls in love with Princess of Basra, daughter of its Sultan- a despot with a penchant for mechanical toys. Coincidentally Jaffar also fancies the pricess of Basra and has designs upon her. This film is the point that really does mark transition and we see Jafar has truly crossed over to the “dark side.”
The subsequent Disney movie [ Aladdin] of 1992 continues and reinforces the narrative of Jafar as villainous vizier sorcerer and all-round bad guy.
- In print media Jafar is portrayed as an agreeable, but astute adviser and a sympathetic all-round good guy. The critical moment of metamorphosis from Vizier to Villain happens in film with Alexander Korda’s 1940 movie Thief of Baghdad which initiates this transformation. Disney’s 1992 Aladdin removes any redeeming features from the character of Jafar. completing the transformation.
*For simplicity I have truncated his name to Jafar