In year 689 of the Tang dynasty, Wu Zetian is to be crowned the first Empress in China despite opposition from Tang officials. She has a Guan Yin figure built overlooking her palace in Luoyang, but an official inspecting the progress mysteriously erupts into flames. Penal officer Pei Donglai and his superior investigate and interrogate the supervising builder, Shatuo, who was formerly imprisoned after he took part in a rebellion. They find nothing and Pei's superior also dies soon after by also erupting into flames.
The Empress orders former detective and rebel Di Renjie be released from prison after the Imperial Abbot states that he must solve the mystery of the fire. She sends her attendant Shangguan Jing'er to fetch Di from prison, and Jing'er arrives just as Di is being attacked by assassins. Wu reinstates Di as the royal detective and assigns Jing'er to be both an assistant and spy. Jing'er attempts to seduce Di, but is interrupted by assassins. Di meets Prince Li, who fails to recruit him into leading a rebel army. When Pei takes Di and Jing'er to inspect the charred corpses, Di deduces the assassins use a poison that ignites upon contact with sunlight.
Pei joins Di in his investigation. Di reunites with his friend Shatuo, who suspects the poison to be the venom of "fire beetles". He points Di to Donkey Wang, who is hiding in a network of caverns called the Phantom Bazaar. Pei orders Shatuo arrested for not telling him of this before, but Di stops him. Di, Pei and Jing'er locate Dr. Wang At the Phantom Bazaar, but are attacked by a figure who seems to be the Imperial Abbot. After Jing'er and Pei fight him, Pei pursues him to the Abbot's forbidden residence. Dr.Wang reveals that he was the court physician and tried to use fire beetles as medicine for the late Emperor. Learning their true danger, he disguised his appearance using acupoints and fled.
Prince Li returns Di's mace to him, which was taken after he was imprisoned. Di maintains his political neutrality, and Li is assassinated soon after. Di suspects the Abbot's involvement, but Wu warns him that he will be killed if he attempts to enter the monastery. Pei finds the first inspector had discovered something in his inspection and takes the diagrams, but he is captured. At the monastery, Di learns that the Imperial Abbot is actually Jing'er disguised using acupoints. Di speculates that the Empress used the Imperial Abbot to justify her tyranny and eliminate her political opponents, possibly including the late Emperor. Jing'er attacks Di, but is unable to kill him. She stumbles into a trap set by the assassins and is mortally wounded. Di fulfills her final request by sending her back to court, and she dies in the Empress's arms.
Di finds Pei, but Pei has already been poisoned by the fire beetle venom and Di is unable to save him. Before he dies, Pei directs Di to the diagrams, which implicate Shatuo. When Di confronts Shatuo at the Buddha, Shatuo reveals his plan to kill the Empress by collapsing the Buddha upon the palace as revenge. He killed both the officials after they noticed his changes to the Buddha and Prince Li for insulting him. He also took the late Prince Li's authority to use Li's army to invade the city and kill Wu if she survives. As Di and Shatuo fight, Di is drenched in the fire beetle poison. Di is able to divert the statue, and Shatuo heads to the coronation to poison Wu. Di catches up with Shatuo and spills the poison on him instead, causing him to burn to death in the sun.
Di saves Wu from the collapsing statue and warns her of the rebel army. The Empress promises to be a just ruler and to return power to the Tang dynasty when her reign ends. Refusing Wu's offer of a place in her court, Di resigns as inspector and retreats into the Phantom Bazaar with Dr. Wang, where he will struggle to live on with his incurable condition.
Detective Dee and the Mystery of the Phantom Flame was directed by Tsui Hark, who is also a co-producer with his wife, Nansun Shi, and made by the Chinese production company Huayi Brothers (also the film's distributor) and production company Film Workshop (the 50th feature film produced by the company).
The screenplay was written by Chang Chia-lu, the Taiwanese screenwriter of the films Forever Enthralled and A World Without Thieves. When asked to direct the film, Tsui said that he would only direct the project if he could make adjustments to the script, which he did.
Reception
China Daily placed the film on their list of the best ten Chinese films of 2010. Time magazine considered it the third best film of 2011, after The Artist and Hugo. Review aggregator Rotten Tomatoes reports that 80% of critics gave the film a positive review, based on 50 reviews, with an average rating of 6.9/10.