The oldest part of the temple was built in 652 by Songtsen Gampo. To find a location for the temple, the king reportedly tossed his hat (a ring in another version) ahead of him with a promise to build a temple where the hat landed. It landed in a lake, where a white stupa (memorial monument) suddenly emerged over which the temple was built. In another version of the legend, Queen Bhrikuti founded the temple to install the statue she had brought and Queen Wencheng selected the site according to Chinese geomancy and "feng shui". The lake was filled, leaving a small pond now visible as a well fed by the ancient lake, and a temple was built on the filled area. Over the next nine centuries, the temple was enlarged; its last renovation was carried out in 1610 by the Fifth Dalai Lama.