During the 13th century Japan was invaded twice. The first battles caught samurais unprepared and almost wiped them out, but they improved their tactics and saved Japan by building a defensive stone wall and attacking at night. This was the country that tried to conquer Japan.