ALAMOGORDO, N.M. — In this sprawling desert city in the shadow of the Sacramento Mountains, local officials are fed up with the border crisis — and have gone rogue.

Otero County last month became the first border community to declare a state of emergency after the federal government shut down two local checkpoints in the area, which had traditionally provided a second line of defense against shipments of drugs and illegal immigrants who managed to sneak through the border at El Paso, about 90 miles to the south.

“It’s a green light for the cartels when border checkpoints are down,” Otero County Sheriff David Black, 56, told The Post.

Black, who has lived in this city of nearly 32,000 people his whole life, said he has 44 “gun toters” overseeing the county’s 6,628 square miles of lonely ranchland and pistachio orchards nestled among national parkland and Holloman Air Force Base.

Now the lawman said he has to deploy his own overworked forces to stop drugs such as methamphetamines, marijuana and fentanyl from coming through his territory, which is home to some 65,000 people.

Otero County is undefended because US Customs and Border Protection shut down two inspection facilities on US Routes 54 and 70, Black said. The Border Protection agents were sent south to El Paso to help with the massive influx of migrants. More than 800 have been arriving per day at the border near El Paso, according to Border Protection statistics.

‘It’s a green light for the cartels when border checkpoints are down.’ - Otero County Sheriff David Black

Last week, The Post visited a Border Protection checkpoint across from the White Sands National Monument, a national park of undulating sand dunes on Highway 70. Two white and green vans belonging to the federal agency were parked at the shuttered facility.

“I’ve had to redeploy my guys,” said Black. Reading from a report on his desk in the Otero County Sheriff’s Office, he told The Post that his deputies seized $60,000 worth of illicit drugs in April. The figure is markedly up from the $3,500 seized in January, when the Border Protection checkpoints were still working, he noted, adding, “We have always relied heavily on those border patrol checkpoints.”

Since last October, Border Protection agents have discovered 7 tons of marijuana and nearly half a ton of methamphetamine in the area, according to CBP statistics.

The unmanned checkpoints are also a headache for Kyle Williamson, the Drug Enforcement Agency’s special agent in charge of the El Paso Division, which includes all of New Mexico and west Texas. His office monitors 770 miles of the US-Mexico border and 11 international ports of entry.

“We’ve lost our second line of enforcement,” said Williamson, 52, a 30-year DEA veteran who did stints in the Middle East and Afghanistan.

For Williamson, the chaotic situation at the border with Mexico is helping drug traffickers smuggle their illicit cargo north.

“Are cartels capitalizing on the confusion at the border? Yes, they are!” Williamson told The Post. “They are using it as a cover to move drugs, which are coming through legal ports of entry. If your drugs are coming through legal ports of entry, you need lines of defense.”

Williamson said his team recently seized 44 pounds of fentanyl — “enough to wipe out all of New Mexico, Texas and the entire state of Chihuahua.”

Most of the drugs are being trafficked by a gang known as Barrio Aztecas, the enforcement arm of the Juarez Cartel, according to the agent.

“They are an incredibly violent gang,” he said, adding that they number between 2,000 and 2,200 members.

An additional 500 to 1,000 Barrio Aztecas are in prison, he said.

For Couy Griffin, chairman of Otero County’s Board of Commissioners, who spearheaded the move to declare a state of emergency last month, the situation is dire. In addition to drug traffickers and migrants, Griffin fears that terrorists may begin taking advantage of the abandoned checkpoints to sneak into the rest of the country.

“We have got to secure our border, period,” said Griffin, 45, who wears a black hat and scuffed cowboy boots, and leads a group called Cowboys for Trump.

In February, members of that group set off on horseback for an eight-day journey from Maryland to Washington in support of the president, and to raise awareness of issues facing fellow businessmen in New Mexico.

Last week, the Otero County Board of Commissioners voted to pass a resolution that says, in part, that no county resources will be used to help migrants. The board “declares its opposition to any and all state and federal agencies dropping off illegal migrants.”

Griffin says he has spoken to elected representatives in other New Mexico counties who may soon join Otero in declaring local emergencies.

“You’ll see. There’s going to be a domino effect when other counties get fed up,” Griffin said. “We want other counties to follow suit. That’s the only way we’ll have a voice and be able to push back.”

In addition to the federal government’s shutdown of the checkpoints, New Mexico’s recently installed Democratic governor, Michelle Lujan Grisham, withdrew 118 National Guard troops from the state’s southern boundary, in defiance of President Trump. Earlier this year, she called Trump’s policies at the Mexican border a “charade of border fear-mongering.”

In the wake of the Border Protection withdrawal, Griffin and Black want the governor to redeploy the National Guard, and they are determined to sue the state if the governor continues to refuse to cooperate, Griffin said.

“Unfortunately, we have a governor who is so interested in politics that she has lost touch with the people of this county,” Griffin told The Post. “We have a governor who continues to claim that there is no crisis at the border.”

Black believes the security issue in Otero County will soon affect the entire country as drugs and terrorists move north. He said he wants “an enhanced wall of border security that is integrated with steel slats,” equipped with state-of-the art monitoring equipment and more guards. If that doesn’t happen, he fears, there will be an increase in crime.

“We give it six months for the crime statistics to start rising here,” he said. “And believe me, all of this is coming to a town near you, all over the country.”