It is said that the history of Yagi-jo Castle began when Akikatsu NAITO (also called Sadafusa) entered Yagi having been granted the Funai district in 1335 because of his military exploits when his army fought alongside Takauji ASHIKAGA in Shinomura Tanba Hachiman-gu Shrine in 1333.
元弘3年(1333年)足利尊氏が丹波篠村八幡宮での挙兵に応じた内藤顕勝（定房とも）が戦功により船井郡を与えられ建武(日本)2年（1335年）に八木に入ったのが築城の始まりとされる。