In 672, during the Jinshin War, Yamashina-dera Temple moved to Fujiwara-kyo (Fujiwara Palace, the ancient capital of Fujiwara) and was called Umayazaka-dera temple after the place Umayasaka, in Takaichi-gun.
壬申の乱のあった天武天皇元年（672年）、山階寺は藤原京に移り、地名（高市郡厩坂）をとって厩坂寺（うまやさかでら）と称した。