Saudi soldiers fire artillery toward armed vehicles approaching the border with Yemen in Jizan, Saudi Arabia, in April 2015. The kingdom has been struggling to stop attacks by Yemeni rebels. (Hasan Jamali/AP)

Thousands of Saudi troops have been deployed along these desiccated hills, struggling to halt cross-border attacks by Yemeni rebels who fire rockets and carry out lethal ground incursions.

The Yemeni fighters have killed and captured hundreds of Saudi soldiers in a conflict that presents Saudi Arabia with the biggest challenge to its territory in years. Thousands of mortar shells and crude rockets have slammed into schools, mosques and homes in Najran, a city of several hundred thousand people only a few miles from the mountains of northern Yemen.

The border assaults have come in response to a devastating air and ground war that a Saudi-led military coalition launched in Yemen last year. That conflict has in turn spilled across the border with devastating consequences, said Maj. Gen. Saad Olyan, who commands more than 20,000 Saudi forces along the 1,100-mile southern border.

“Just last week, 10 of my men were killed by these militiamen on the border,” he said. His forces are battling increasingly sophisticated ambushes by the Yemeni rebels, known as Houthis, and units from Yemen’s splintered military.

“Some of them were killed in an ambush, shot in cold blood” by the rebels, Olyan said during an interview at his Najran headquarters, which has been struck by rocket fire.

Najran residents try to go about life normally, but the scars left by the Yemeni attacks reflect how brutal the fighting has become. Dents in the streets that appear to be potholes were actually made by exploded mortar shells. Many schools — some of which have been hit by Katyusha and Grad rockets — have been closed. Thousands of residents living in border communities have been moved to safer ground, and Najran’s airport has been closed to civilian air traffic because of the fighting.

“The attacks come suddenly, and you can’t do anything about them,” said Abdullah al-Nasser, 41, an administrator at a nursery school in Najran that was hit by a rocket several months ago. Fortunately, he said as he walked through the school’s destroyed auditorium, there were no casualties.

Thousands of civilians have been killed since the Saudi-led military coalition — which includes mostly fellow Sunni Muslim nations — intervened in Yemen, exacerbating a humanitarian crisis in the desperately poor country. Saudi Arabia intervened to stop assaults by the Houthis, followers of the Zaydi sect of Shiite Islam who toppled Yemen’s Saudi-backed government last year. Saudi officials accuse the Houthis of acting as proxies of Iran, a Shiite-led powerhouse and the kingdom’s foremost regional competitor.

In turn, the rebels and allied military units loyal to former Yemeni president Ali Abdullah Saleh have sought to inflict pain on Saudi Arabia by launching intense cross-border attacks. Houthi-affiliated media outlets regularly report that the rebels have stormed deep inside southern parts of the kingdom, including near Najran.

The city sprawls with drab, low-slung apartment buildings and lacks the hustle and bustle of Riyadh, the capital, about 500 miles to the north. The old downtown, which dates back hundreds of years, features quaint shops that sell ornamental knives, traditional desert clothing and spices.

The place would feel like a sleepy village were it not for the raging conflict.

The fighting comes amid a wave of attacks in the kingdom claimed by the Islamic State, ­including a suicide bombing in October that killed one worshiper at a mosque in Najran. Saudi officials, moreover, have been forced to mobilize a massive number of troops along the Yemen border at a time of financial hardship from slumping oil prices and expensive outlays that include propping up Egypt’s increasingly authoritarian leadership and backing rebels in Syria’s civil war.

“The Houthi-Saleh threat to southern Saudi is off the charts,” said Theodore Karasik, a Dubai-based analyst who specializes in Persian Gulf security issues.

Although part of Saudi territory, areas in the south historically have been claimed by Yemen. Residents of Najran and surrounding territory have strong family and cultural connections to communities in Yemen.

Furthermore, the majority of residents in Najran are Ismailis, an offshoot of Shiite Islam. They have long complained of discrimination by Saudi authorities, who officially practice a particularly conservative form of Sunni Islam whose followers regularly condemn Shiites as apostates.

“The Ismailis are seen as heretics by the conservative Saudi elite,” said Karasik, who noted that the Yemeni rebels appear to be attacking the area to test the loyalties of Ismailis.

But some Ismaili residents of Najran say that the Yemen war actually has improved relations with Saudi authorities. Abdullah Sedran said that the military and government officials have attempted to reach out to the local Ismaili population during the crisis.

“There is a sense that the discrimination has decreased, and you feel that the government has done a lot to restrict the extremists who call us infidels,” said Sedran, 52, an Ismaili who lives in Najran.

Fahad Nazer, a former political analyst at Saudi Arabia’s embassy in Washington, said local tribesman have rallied around the Saudi cause.

“A number of videos have circulated on social media showing tribal leaders in Najran and Jizan reciting poetry and expressing gratitude to the troops stationed there,” he said, referring to another Saudi area attacked by Yemeni rebels.

Col. Yaser al-Qahtani said he has noticed a sense of solidarity during the conflict. He heads the air defenses around Najran, including Patriot missile batteries that defend the area from ­Yemeni-fired Scud missiles, ­longer-range projectiles capable delivering a large payload.

On a recent day, he displayed the U.S.-made missile defense system to a visiting journalist as he spoke about the suffering experienced by civilians and soldiers.

“I was at work when a missile destroyed my home here,” said Qahtani, 43, a Najran resident and father of four. “Luckily, my family wasn’t there, or they all would have been killed.”

He added, “We are all together in this war.”

Sheikha Aldosary contributed to this report.

Read more:

Today’s coverage from Post correspondents around the world