Colonial authorities & lackeys (Iturbide et al) killed most of the republican oriented patriots. Then they zig zaged & decided to become independent of Spain, but the damage was already done. What followed were decades of political turmoil between ex royalists to see who controled the country.

Had Morelos or Allende or any other original patriot ruled the country from the very start, the northern countries would had been settled properly & the USA would had never conquered them