Based on an investigation of the Temple of the Heavenly Kong of Dunhuang and the text of the Suramgama-Samadhi-Sutra, the authors hold that the Temple of the Heavenly King is a temple of the Suramgama-Samadhi, established by the Tibetans to counteract the influence of the various non-Buddhist sects upon the Tantrist doctrine and the corruption of the monks. The rebuilding of the temple by Cao Yanlu is possibly motivated by the attempt to counteract the various non-Buddhist thoughts.