The correct answer is the Mexican-American war
He became a national hero after the Mexican-American war where he fought and won many battles as a war general. This is why people chose him even though he wasn't a political figure and never really expressed support for either party's goals and was rather vague on the whole thing. His presidency was brief since he died only 16 months in.