At a remote, monsoon-soaked border checkpoint, Indian soldiers will mark Independence Day by raising the country’s tricolour on a mast that towers above a Pakistani flag flying just across the frontier – part of an ongoing vertical duel in South Asia’s fraught politics.

Call it flag warfare: a contest not of weapons but of height, waged by two nuclear-armed neighbours that only three months ago fought a four-day battle which threatened to escalate into full-scale war.

This year’s flagpole frontline is Sadqi, a quiet patchwork of wheat fields in northern Punjab state’s Fazilka district. India’s Tiranga, or tricolour, will fly from a new 200-foot (61-metre) galvanised-iron mast. Across the barbed-wire frontier at Sulemanki, Pakistan’s green-and-white Parcham-e-Sitāra-o-Hilāl flutters from a 165-foot (50-metre) pole.

“While this ‘flagpole war’ might look like just a symbolic contest, it’s freighted with emotional and nationalist overtones, especially in the context of the India-Pakistan rivalry, where tensions touch people’s lives on both sides,” says Indian military expert Rahul Bedi.

Indians and Pakistanis gather to watch the beating retreat ceremony at the Attari-Wagah border between Pakistan and India. Photograph: Narinder Nanu/AFP/Getty Images

Pakistan celebrated its Independence Day on Thursday, a day before India’s national holiday. Pakistani leaders delivered customary barbed speeches against India. India countered, warning Pakistan to temper its “reckless war-mongering” or face “painful consequences.” The neighbours have fought four wars since independence, along with countless smaller skirmishes.

Each evening, India stages three flag-lowering ceremonies along its heavily militarised Punjab border with Pakistan, including at Sadqi.

Flagpole one-upmanship is now a tradition woven into the pomp of the nightly flag-lowering ceremonies, which are part military drill, part nationalist pep rally.

The biggest and most famous ceremony is at the Attari-Wagah crossing. It started in 1959, 12 years after the subcontinent was split into Hindu-majority India and Muslim-majority Pakistan following the end of British colonial rule.

As the Attari-Wagah ceremony grew more elaborate – and more belligerent – the rivalry moved skyward: India planted a 360-foot (110-metre) pole in 2017; Pakistan countered with a 400-foot (122-metre) mast. Six years later, India went taller again at 418 feet (127 metres).

Pakistani Rangers take part in the beating retreat ceremony at the Attari-Wagah border. Photograph: Narinder Nanu/AFP/Getty Images

Pakistan’s latest response is not another pole but plans for a multimillion-dollar Mughal-style stadium, set to triple seating to 25,000, along with a museum and a theme park.

The Attari-Wagah ceremony began when Indian and Pakistani officers, many once comrades in the British colonial army, agreed to lower their flags simultaneously each evening – a sign of respect and shared discipline despite nationalist animosity.

Over time, though, that simple ritual became an hour-long, high-octane display of choreographed combativeness. Grandstands overflow with spectators waving flags and chanting: “Pakistan Zindabad!” from one side, “India Zindabad!” and “Bharat Mata ki Jai!” from the other.

India’s Border Security Force jawans, in khaki uniforms with red fan-shaped turbans, red-and-gold sashes, white gloves, and black boots, march in unison with Pakistan Rangers, in black uniforms with green accents and tall ceremonial hats. Both sides pick their tallest men who stomp, kick their legs skywards, and slam their heels in precise, mirrored movements.

The Attari-Wagah border crossing point between India and Pakistan. Photograph: Aakash Hassan/The Guardian

At the flag-lowering ceremonies, Indian and Pakistani soldiers do not rehearse together, but they match each other’s moves. The sequence, pace, and gestures are set by tradition, with each side adjusting to mirror the other’s steps, stomps and salutes.

It’s “pure theatre,” says Bedi. “It’s a grand stage for showing off patriotism, all about the spectacle.”

“The flagpole rivalry also bizarrely quickly morphed into a kind of giant-flag arms race,” he adds. “But these supersized banners have been no match for the border winds, which can be really strong, and the flags can be in shreds within weeks.”

That problem remains unsolved, so both sides fly smaller flags most days. For instance, Sadqi will hoist a 12×18-metre tricolour on Independence Day, and a smaller one on regular days.