The phrase
尊王攘夷 originates with Duke Huan of Qi and his minister Guan Zhong (~7th century BCE) — rallying Zhou-dynasty vassals against nomadic incursions. Bakumatsu Japan revived it (sonnō jōi
尊皇攘夷) as the slogan against Western powers in the 1850s–60s.