Mexico's deadly drug-related violence surged to a new record in June, with 2,566 homicides that month alone.

The country has seen a steady rise in killing since around 2015, and last month and the first six months of the year both had more homicides than any of the same periods over the past two decades.

Mexico's most popular tourist areas have largely avoided that bloodshed. But that trend appears to be reversing.

In Quintana Roo, a state in Mexico's southeast home to the resort areas of Cancun and Playa del Carmen, the 134 homicides registered so far this year are nearly equal to the 165 seen all last year, according to government crime data.

The Benito Juarez municipality, where Cancun is located, has already exceeded last year's total of 89 homicides, with 95 through June. In Solidaridad, the municipality Playa del Carmen is in, the 21 homicides seen through June is nearly as many as the 26 there were all last year.

The violence has largely taken place outside of areas frequented by tourists, who drive what is a $20 billion industry for Mexico, and statistics suggest it hasn't had great effect on how many people are visiting — occupancy rates exceed 90%. Cancun's government and the criminal groups involved have similar reasons for keeping the killings from being publicized.

Mexico nightclub shooting Playa del Carmen blue parrot police

(Police guard the entrance of the Blue Parrot nightclub in Playa del Carmen, January 16, 2017, after a deadly shooting there while it was hosting part of the BPM electronic music festival.(AP Photo))

But the bodies have continued to pile up. Three men were shot at a nightclub there in November. In January, back-to-back shootings marred life in both Cancun and Playa del Carmen.

The latter incident, a January 17 shooting outside a nightclub in Playa del Carmen, left five people dead. The next day, gunmen on motorcycles attacked state government and security buildings located about 5 miles from the Cancun's hotel district, leaving at least two people dead, including a police officer.

In June, one suspect was killed and two wounded in a shootout in a downtown area of Cancun; the next day, two dismembered bodies were found in a suitcase in a marshy area outside the city's tourist zone. A government survey that month also found 79% of Cancun residents saw the city as "insecure." In July, a shootout on a main avenue in Cancun left three injured, and a police commander was killed outside his home later that month.

Homicides in Quintana Roo

(Christopher Woody/Mexican government data)

Organized-crime groups, lack of development, and ineffective policing all contribute to crime in the area.

The turf war that erupted after the capture of Sinaloa cartel chief Joaquin "El Chapo" Guzman appears to have spread to the area, which is an entry and transshipment point for narcotics.

The Sinaloa cartel's main rival, the Jalisco New Generation cartel, is present in the Cancun-Playa del Carmen corridor, as are the Gulf and Zetas cartels.

There also smaller criminal groups in the area with loose ties to larger organizations, but those looser ties can also lead to more violence.

Those groups also prey on the area's legitimate businesses, extorting nightclubs, bars, and other outlets in and around the hotel zone.

Cancun's heavy focus on tourism has come at the expense of locals who often deal with an underdeveloped and disordered urban expanse.

"Everyone says we live in paradise. But there’s a heaven and hell here. Hell is the colonias" where residents live, Ildefonso Pool, an Uber driver and 37-year resident of Cancun, told USA Today. "This city brings in more money than any other in the country, and people live in a garbage dump."

With heavy population growth — 5.9% in the 1990s and 4.1% in the 2000s, the highest growth rates in Mexico during those periods — there is a large population in the state with dim economic prospects.

Mexico Playa del Carmen nightclub shooting police

(A police officer outside the Blue Parrot nightclub after a shooting there killed several people and injuring others during an electronic music festival, in Playa del Carmen, January 16, 2017.REUTERS/Victor Ruiz Garcia)

Like elsewhere in Mexico, impunity and ineffective law enforcement have also contributed to Quintana Roo's violence. "Most cases are not even investigated and go unpunished," because of indifference by authorities and residents, Teresa Carmona, an anti-crime activist, told USA Today.

Cancun has fired 150 police officers since May for failing vetting tests (a widespread problem among Mexico's law-enforcement bodies). It is also shifting officers from desk jobs to street patrols.

"Events are happening that weren’t common in this city," Mexican army Lt. Col. Darwin Puc Acosta, who took over as Cancun's police chief in June, told Bloomberg. "I sincerely don’t consider them alarming. They’re situations that can be resolved if they’re attended to properly. And that’s what we’re doing."

The federal government has already sent troops to Cancun to help reinforce security forces there, and municipal authorities recently brought on Julian Leyzaola, who inspired fear and praise during his time as police chief in Ciudad Juarez and Tijuana, as an adviser.

Three dismembred bodies were found in the Mexican beach resort of Cancun, scene of an armed confrontation between police and criminal gangs. Troops shown here were dispatched to help restore calm

Nevertheless, the state has also seen the emergence of a vigilante group —a 200-man team operating out of the woods and claiming to have politicians and police under 24-hour surveillance.

The group was formed Carlos Mimenza, a businessman, who saw one of his companies robbed at gunpoint in November. Mimenza rails on YouTube against officials he accuses of colluding with cartels, but the local government has said none of his claims have been borne out.

Mimenza, who demurred when asked if his force carried weapons, told Bloomberg that cartel violence "is a problem that the government itself has permitted, and the same government is the only one that can resolve it."

'All this derives from after they arrested El Chapo'

Across the country from Quintana Roo, the idyllic resort area of Los Cabos, in the municipality of the same name at the southern tip of Baja California Sur, drug-related conflict has continually pushed homicides to new levels.

The 175 homicides seen in 2015 were more than double the 84 in the state in 2014. 2016 had a nearly 30% increase over 2015, with 225 homicides. Through the first six months of 2017, the state has had 252 homicides.

Baja California Sur, adjacent to violence-ridden states of Baja California and Sinaloa, had a reputation for tranquility amid Mexico's narco turmoil. But that perception has been challenged, especially in the three years since Guzman's first capture in early 2014.

Over that period, the Sinaloa cartel's internal and external conflicts have become more prominent, driving much of the violence that has swirled around Los Cabos and La Paz, the state's capital. In Los Cabos, the 133 homicides in the first half of the year more than doubled the 62 seen all last year. The 54 homicides in La Paz this year are just under half of the 123 registered there all last year.

A battle for control of smuggling routes drove killings up for a roughly year-long period between 2014 and 2015, as Ismael "El Mayo" Zambada, Guzman's partner at the top of the cartel, fought with forces led by Damaso Lopez Serrano, the son of Guzman's former right-hand man. (Both of the Lopezes were captured this year.)

Baja California Sur homicides

(Christopher Woody/Mexican government data)

Outside rivals have played a role in the bloodshed.

The Jalisco New Generation cartel, "is wanting to enter La Paz, Ensenada, and Tijuana," a police official told El Universal in mid-2016, referring to two cities in Baja California Sur and a third, Tijuana, on Baja California's border with the US.

"All this derives from after they arrested El Chapo. [Nemesio Oseguera] El Mencho is returning to attack the plazas," the official said at the time, referencing the CJNG's well-known leader and drug-trafficking territories known as plazas.

Mexican officials have said tourism has been unaffected — and one San Diego travel agent said the region was still appealing as a quick getaway from Southern California — even with the increase in violence during the first half of this year.

Occupancy in Los Cabos hotels averages 74%. But 54% of residents say they feel insecure, and killings have continued this summer.

Nineteen people were slain during the first full week of June — incidents accompanied by the discovery a mass grave with at least 18 bodies, reportedly the work of Damaso Lopez Nuñez, the father of Damaso Lopez Serrano.

"Uncovering that grave has uncovered the reality that we are living in the state," Alberto Renteria, a hospitality workers' union official and state president for leftist opposition political party Morena, told Reforma, calling it "a terrible reality" the state government has tried to hide.

More than 230 people have been murdered in Los Cabos alone so far this year

Later in June, a man thought to be a boss in the Tijuana New Generation cartel, a group formed by the CJNG and remnants of the Tijuana cartel, was arrested in Los Cabos. At the end of June, authorities found a suitcase full of human remains on a road leading to the Los Cabos hotel zone.

Though violence around Los Cabos has largely avoided tourist areas, they have not totally been spared. During the first weekend of August, at least five gunmen attacked a group on a beach, killing three men, severely wounding a man and a woman, and forcing authorities to evacuate the beach, which was crowded with tourists.

"We heard the bullets and we started running, in order to protect ourselves, they were machine-gun bursts," a tourist from Mexico City told AFP of the incident, which Tijuana-based outlet Semanario Zeta captured on video:

The killings pushed the state's homicide total for the weekend to 11, concentrated in Los Cabos. None of those cases have led to arrests, according to El Universal. The state also leads the country in extortion, with 133 cases this year.

The mayor of Los Cabos has touted the city's security efforts, including "purging" the city's police ranks and allotting more resources to them.

The governor has said the state is working to improve the state police's salaries and benefits and to expand their ranks, but he admitted that some officers who have failed vetting tests have not been dismissed because the state can't cover severance pay.

'Next time, we will not come back'

Mexico saw a 9% increase in tourist visits in 2016, but the upticks of violence in Quintana Roo and Baja California Roo have given Mexican businesses and officials an unpleasant reminder of what in recent years has befallen Acapulco, a once vibrant tourist hub in Guerrero state.

Between 2011 and 2016, Acapulco had homicide rates above 100 per 100,000 people five times and had the highest rate in the country five times as well, according to the Justice in Mexico project.

Homicides in Acapulco

(Christopher Woody/Mexican government data)

The city had 908 homicides last year and 412 through June this year, according to the federal government. Other counts say there were 105 in July alone.

The city, which is linked by highway to the country's interior, is a vital hub for traffickers moving up and down Mexico's Pacific coast and links them to the state's expansive opium and marijuana cultivation areas.

An array of criminal groups have emerged there in recent years, and it's believed the Sinaloa cartel is there vying for control with the CJNG and its partners.

The high level of violence has forced many businesses out, and some that remain only open on the weekends because people no longer go out as much.

In early July, the country's tourism secretary, Enrique de la Madrid, announced the government would implement a trial security program in Los Cabos, Cancun, and Acapulco that month, because those areas "are the destinations that concern us most at the moment because of the impact they have on [Mexico's] image abroad."

The federal government has called on businesses, local and state governments, and residents of the tourist areas to help fund the program, and the rule of law and political institutions still need to be strengthened, said de la Madrid.

Acapulco, Mexico

(Soldiers stand guard along a street during an operation to help increase security and prevent violence in Acapulco, Mexico, October 27, 2015. The Mexican Army and Federal Police are patrolling together in areas of Acapulco, according to local media.REUTERS/Claudio Vargas)

Acapulco, like Los Cabos, Cancun, and Playa del Carmen, has seen public displays of brutality in recent weeks as well.

Several people were killed in and around the city's tourist area near its beaches during the first days of August, including one incident on August 4 in which a person chased down another and killed them on a street just yards from the water.

"It is incredible what is happening here in Acapulco," said one witness, a Mexico City resident vacationing in the city with family. "Next time, we will not come back."