Earthworks and wooden fortresses were also built throughout the countryside to defend the territory from the native Emishi, Ainu and other groups; unlike their primitive predecessors, these were relatively permanent structures, built in peacetime.