A month before the Mexican photojournalist Rubén Espinosa was murdered in Mexico City in late July, the governor of Veracruz, the province Mr. Espinosa had fled fearing for his life, gave other journalists a warning.

“Behave,” Javier Duarte, the governor of Veracruz, urged reporters. “We’re going to shake the tree and a lot of rotten apples will fall.”

Mr. Duarte said that his warning was meant to deter journalists who are sympathetic to drug traffickers and other criminals. But many Mexican journalists understandably saw it as a threat to journalists who produce critical coverage of local officials.

Since 2010, at least 41 journalists have been killed in Mexico. Roughly 20 have disappeared. Mexican journalists are targeted by powerful criminal organizations and in some instances by government officials who don’t want their misdeeds exposed. The majority of cases remain unsolved, leaving journalists in many parts of the country with a terrible choice: they censor themselves or get silenced by a bullet.