How and why did the Shinsengumi become such heroes in Japanese culture?

by Super-Soviet

The great popularity of the Shinsengumi in Japanese popular culture has always struck me as a bit odd. As the police of the Shogunate who fought against the Meiji Restoration, weren't they on the wrong side of Japanese history? Yet they seem to have be given the status of folk heroes were one might imagine another nation would have cast them as villains or consigned them to obscurity.

Is this status a result of their contemporary popularity (if they even had any) with the Japanese public during the Edo period? Or did it come about later? Was it a Meiji period thing, a sort of subversive nostalgia for the underdogs, or is it something that only developed later, maybe in the late Showa era?

Super-Soviet

Oh and I just noticed this does suit this weeks theme of political violence sort of.

ParallelPain

I asked the exact same question before. You might be interested in the answer I got here, credits to /u/hintonrobo.

Of course, any additional answers are welcome.