MEXICO CITY — The forces driving violence in Mexico, which is now on track for its worst year in decades, were first set in motion 20 years ago by two events that were, at the time, celebrated as triumphs.

First, Colombia defeated its major drug cartels in the 1990s, driving the center of the drug trade from the country into Mexico.

Then, in 2000, Mexico transitioned to a multiparty democracy.

This meant that the drug trade moved to Mexico just as its politics and institutions were in flux, leaving them unable to address a problem they have often made worse.

Since then, a series of bad breaks, missteps and self-imposed crises have led to an explosion of violence. Last year there were more than 20,000 killings. This year is on track to be worse, exceeding the 2011 record, which was thought to be the drug war’s apex.