American troops in Afghanistan riddled a passenger bus with bullets outside Kandahar on Monday, killing four civilians and galvanizing anti-Western sentiment just as NATO is gearing up for a massive military offensive in and around the southern city.

Angry protests erupted after the shooting in Zhari district, to the west of Kandahar, which also left 18 people hurt.

NATO’s International Security Assistance Force said it “deeply regrets the tragic loss of life” in the shootings, and it promised a speedy joint investigation with Afghan authorities.

Tensions have been running high before the planned Western push to expel the Taliban from Kandahar, which the insurgents consider their spiritual home.

Coalition troops, mainly Americans and Canadians, have been trying to clear and control major roads near the city -- a task that leaves them vulnerable to vehicle-borne suicide bombers and so-called improvised explosive devices, or IEDs.

Civilians, in turn, risk being mistaken for a threat by the Western forces if they drive erratically or stray too close to military convoys.

The early-morning shooting occurred after a crowded bus traveling on the main highway out of Kandahar came up behind several slow-moving Western military vehicles that were engaged in road clearing, said Zalmai Ayubi, a spokesman for the governor of Kandahar province.

Under what NATO calls “escalation of force” rules, troops are ordered to use nonlethal means when possible to prevent a suspicious vehicle from getting too close. Military officials said troops tried to signal the driver to stop, using flares, flashlights and hand signals.

With the bus gathering speed instead of slowing, the troops opened fire on it, according to the military’s account -- realizing only afterward that the vehicle was a passenger bus.

As word of the shootings spread, protests broke out on the city’s outskirts. Witnesses said demonstrators burned tires on the main road and shouted slogans condemning both the United States and President Hamid Karzai.

NATO did not acknowledge that the troops involved were Americans, but local officials and a Western military official, speaking on condition of anonymity because he was not authorized to discuss the event, described them as U.S. forces.

The timing of the incident is particularly sensitive, coming as U.S. officials are trying to persuade Karzai to lend his full support to the Kandahar offensive. The Afghan leader issued a statement in which he strongly condemned the shooting and offered condolences to families of the dead and injured.

Last week, Karzai, who is from a village outside Kandahar, attended a shura, or tribal gathering, in the company of U.S. Army Gen. Stanley A. McChrystal. There, he assured elders that the campaign would not be conducted without their backing.

American officials insist that Karzai’s wishes will be paramount as planning of the offensive goes forward. In practical terms, however, the offensive is already something of a juggernaut. Nearly half of the 30,000 additional troops President Obama ordered sent here have already arrived, and most are being deployed in the south. McChrystal himself has described the operation as already underway.

Karzai has been a harsh critic of civilian casualties at the hands of coalition troops. Insurgents last year were responsible for about three-quarters of the noncombatant deaths, according to U.N. figures, but deaths and injuries attributed to Western forces tend to be far more politically explosive.

On the eve of February’s U.S. Marine-led offensive in Marja, in Helmand province, the Afghan leader gave what seemed to be only a grudging endorsement of the campaign, emphasizing that civilian lives must be safeguarded.

Adding to a growing sense of chaos in Kandahar, three would-be suicide bombers launched an abortive attack on an intelligence services compound about six hours after the bus shooting, officials said. One of the bombers was captured, one blew himself up and the other was shot to death by police.

laura.king@latimes.com