HIRMAN, Iran — Sitting next to the half-open door of a Russian-made Mi-17 transport helicopter, the general who leads the Islamic Republic’s antinarcotics department pointed toward the rugged landscape of Iran’s volatile southeast, where its border meets those of Afghanistan and Pakistan.

“This is where the drug convoys for years crossed into our country, almost with impunity,” Brig. Gen. Ali Moayedi said in Persian. Below him, sharp-edged mountains gave way to desert lands scarred for mile after mile by trenches nearly 15 feet deep and concrete walls reaching a height of 10 feet.

The earthworks were built by his men in recent years in a determined effort to stop the most prolific flow of drugs in the world, a flood of heroin and opium bound for the Persian Gulf and Europe. Iran, as the first link in that long and lucrative smuggling chain, has for decades fought a lonely battle against drugs that its leaders see as religiously inspired, saying it is their Islamic duty to prevent drug abuse.

Nearly a decade ago Sistan va Baluchestan Province was an active battlefield, where more than 3,900 Iranian border police officers lost their lives fighting often better-equipped Afghan and Pakistani drug gangs along nearly 600 miles of Iran’s eastern border. In those days, smugglers with night-vision equipment would roll over the border in all-terrain vehicles with heavy weapons, actively engaging Iranian law enforcement forces wherever they found them. Security forces were at times dying by the dozen each day.