The Amanto (星天人) are aliens. The first ones, the Inuisei Amanto 戌威星天人 came to Edo 20 years before present day. The rise of the Amanto led to the decline of the Samurai, as explained by Shimura Shinpachi in Episode 3.
According to Shinpachi when the Amanto invaded, the 12th Shogun collapsed from anxiety and the 13th Shogun Tokugawa Sada Sada has to replace him.
Tokugawa Sada Sada explained with the country opened, Samurai accused the Bakufu as traitors for selling out their country. The relationship between Amanto and Bakufu were deteriorating and this caused a long civil war called the Joui War. Against their superior technology, the samurai had no chance of winning.
When War is breaking out, the Amanto intervene the government. The Tendosu helped the Bafku set up the Kansei Purge. There were major decline to Joui movement because they mercilessly hunted down remnants of Joui Patriots.