MEXICO CITY — Running for public office in Mexico has long been perilous, with threats, assaults and sometimes outright killings by criminal gangs, political rivals and other opponents.

But this season is one of the worst in recent years, some experts say, with at least six candidates killed since February and another wounded in an attack that left her husband and an assistant dead. Party and campaign officials have also been assaulted, their family members targeted and sometimes killed as well.

As nearly half of Mexico’s states prepare to hold local elections on Sunday, the outbreak of violence has proved an embarrassment for the new government of President Enrique Peña Nieto, who has promised to control violence and has sought to portray the country as on the mend from wanton killings.

While the Peña Nieto administration promised to take steps to protect voters, opposition leaders have called on the president to put the army in the streets in some states to ensure peaceful voting proceedings, a common practice here.