Both sides accused each other of shooting first.
The clash came amid an escalating dispute between Kabul and Tehran over the Helmand River, which is a vital source of water for both sides, supporting agriculture, livelihoods and ecosystems in the region.
Afghanistan and Iran have been at loggerheads over the sharing of river water for over a century.
The Helmand is Afghanistan's longest river. It originates near Kabul in the western Hindu Kush mountain range and flows in a southwesterly direction through desert areas for a total of about 1,150 kilometers (715 miles) before emptying into Lake Hamun, which straddles the Afghanistan-Iran border.
Lake Hamun is the largest freshwater lake in Iran.
It used to be one of the world's largest wetlands, straddling 4,000 square kilometers (1,600 square miles) between Iran and Afghanistan, fed by the Helmand.
But it has since dried up, a trend experts blame on drought and the impact of dams and water controls.
The lake is of great importance for the regional environment and economy.
What do Tehran and Kabul accuse each other of?
Afghanistan and Iran signed an agreement — the Helmand River Treaty — in 1973 to regulate the allocation of river water.
But the accord was neither ratified nor fully implemented, causing disagreements and tensions to persist.
Iran has accused Afghanistan of violating its water rights for years, arguing that far less water than the amount agreed to in the 1973 treaty flows into Iran.
"Last year, Iran received only 4% of its share of the river water," Hassan Kazemi Qomi, Iran's ambassador to Afghanistan, said last week in an interview with the state-run Tasnim news agency.
Afghanistan has rejected Iran's accusations, underlining that climatic factors like a shortage of rainfall, resulting in reduced river water volumes, are to blame for the situation.
A major source of concern for Iran is Afghanistan's construction of dams, reservoirs and irrigation systems along the Helmand River. Tehran fears that these projects reduce water flow into Iran.
But Kabul argues that it is within its rights to expand water storage and irrigation capacities within Afghanistan.
What's the state of Tehran-Taliban ties?
Iran and Afghanistan share a 950-kilometer land border. Both countries have no major territorial disputes.
Tehran had cultivated good ties with the Taliban before the Islamic fundamentalist group captured Kabul in August 2021 as US and NATO troops were in the final weeks of their pullout from Afghanistan.
Both sides were united in their opposition to the US's presence in the region.
Even though Iran has so far refrained from formally recognizing the Taliban government, it has been pragmatic and maintained relations with Afghanistan's current rulers.
A close relationship with Kabul is essential for Tehran to achieve goals such as the preservation of Lake Hamun.
But, since the Taliban seized power, there have been repeated incidents at the border.
"Six months before the Taliban seized power, Tehran received a Taliban delegation, in part to reach agreements on water rights. The Taliban now seem unwilling to honor those agreements," said Najib Agha Fahim, an environmental expert from Afghanistan.
Fahim served as a minister responsible for combating natural disasters in President Ashraf Ghani's government, which collapsed in August 2021.
He stressed the need for a sustainable solution to resolve the water dispute.
"To achieve this, officials and subject matter experts from both countries need to work more closely together and share information to determine how much water is available and how much has flowed into Iran."
'Both sides are looking for short-term solutions'
Nik Kowsar, an Iranian environmental expert based in the United States, said both Tehran and the Taliban were showing no interest in addressing the mismanagement of water resources and tackling the environmental problems in the region.
"Both sides are looking for short-term solutions and want to solve their own internal problems," he said. "The Taliban want to promote agriculture," he added. "And the government in Tehran is acting as if it suddenly cares about the disadvantaged province of Sistan-Baluchistan after the nationwide protests last year."
Despite a brutal clampdown, demonstrators in Sistan-Baluchistan continue to gather in the streets to protest the political system.
Water resources from Lake Hamun are critical to the drought-stricken province, one of the poorest areas in the country.
According to Iran's parliament, 25% to 30% of the population has left the region over the past two decades because of the water shortages and moved to the suburbs of cities in other regions.
What's the current situation?
Public anger in the eastern Iranian region has already been mounting amid water shortages and other economic and social problems. And the latest clash between Iranian and Taliban troops increased the tensions.
On May 28, the commander of the Iranian army's ground forces and the deputy chief of the Iranian police traveled to Sistan-Baluchistan, and said the situation was under control.
Tehran and Kabul have also agreed to set up a commission of inquiry to find out what happened in the border shootout.
In Iran, many people are angry, given that three Iranian soldiers have lost their lives.
"Some people wish for a war against the Taliban," Brigadier General Amir Ali Hajizadeh, commander of the Iranian Revolutionary Guard Air and Space Forces, said at an event at the Iran University of Science and Technology in Tehran on May 29.
"However, our enemies are behind these provocations," Hajizadeh said. "They want to start a war out of these clashes on the border. There is no way it will happen."
This article was originally written in German.
Edited by: Shamil Shams