Since Yamashiro Province (southern part of Kyoto Prefecture) was located behind Nara-yama (Mt. Nara) as viewed from the capital of Nara, it was named "yamashiro" which meant 'behind a mountain' and was spelled "山代" in ancient times and "山背" in the seventh century.
山城国（京都府南部）は、奈良の都（みやこ）からみて奈良山の背後にあたるので、山の後ろという意味で“やましろ”と名付けられ、古くは“山代”、7世紀には“山背”とも書いた。