The two American commanders, armed with black assault rifles and flanked by their security details, dropped in on the mayor of Balad on Saturday to offer congratulations and thanks for his efforts during Iraq's constitutional referendum.

Setting down the phones he held to each ear, the mayor, Fawzi Khalif, wouldn't hear of it. It was the Americans, he insisted, who should be thanked for giving the Iraqis everything they needed.

"No, we're invisible," responded Lt. Col. Jody L. Petery, smiling. "We're invisible."

Commanders had sought to play down the role of the U.S. military in the referendum, portraying the vote as a critical step in the transfer of authority to Iraqi forces. But when the day finally arrived in Balad, an agricultural city about 50 miles north of Baghdad, it showed precisely the reverse: how the U.S. military remains an all-encompassing presence in Iraq's political process.

"To be frank with you, they gave everything to us," Khalif said in an interview. "They secured the area. They helped the local government in every detail related to the election."

Far from invisible, on the eve of the referendum Petery's forces fired nearly 40 artillery and illumination rounds into Balad's unpopulated outskirts to preempt mortar and rocket attacks. F-16 fighter jets and Apache attack helicopters were overhead throughout the day, and U.S. troops traveling in Bradley Fighting Vehicles and armored Humvees provided round-the-clock support.

When the Iraqi electoral commission encountered registration problems, causing hundreds of voters to be turned away early Saturday, officials turned to Petery for help. Even in Samarra, a restive city near Balad that was the scene of two major U.S. offensives last year, local Iraqi officials went to American commanders for more ballots when they ran out.

Asked if he thought the referendum could have been held without significant U.S. support, Army Spec. Christopher Burns, 22, of Tallahassee, Fla., said: "No, I don't, not whatsoever. . . . We have to hold their hand to do everything around here."

The Bush administration has made the establishment of Iraqi security forces, particularly the army and police, the prerequisite for drawing down American troops and ultimately, the U.S. military withdrawal from Iraq.

Army Col. Mark McKnight, whose 1st Brigade oversees Salahuddin province, in which Balad is located, praised the performance Saturday by Iraqi security forces, who delivered and collected ballots and manned polling sites. "To me, the involvement of the ISF was the biggest difference" since January, when the U.S. military orchestrated Iraq's parliamentary elections, McKnight said.

Violence is the primary reason American troops are so heavily involved in Iraq's political progress. Bombs and small-arms attacks have restricted entities such as the State Department, the United Nations and nongovernmental organizations. No foreign election monitors were present Saturday. Representatives of the Independent Electoral Commission of Iraq reported turnout to soldiers and officials at a command center located on a U.S. base.

For U.S. troops, who have been working 16-hour days in preparation for the referendum, the military's unconventional role has become an increasingly contentious issue.

"It's not what we were meant to do as soldiers," said Burns. After nine months in Iraq, he said, he was convinced that the military had committed itself to a misguided process. The constitution, he predicted, would only be "meaningful on paper," because the United States was trying to impose a system that Iraqis seemed to neither want nor understand.

"I'm not trying to disrespect what my commanding officers or my high enlisted NCOs have done," he said. "They're doing the best job they can with the cards they were dealt. But it's like we've got a full house and Iraq's got a straight flush and you really can't work with that. You just gotta hope they fold."

Sgt. Maj. Darryc Webster, 45, who has spent 27 years in the military, disagreed. "Being a superpower, I think we're obligated to do these kinds of things for people that are less fortunate. I think that's what we're made of," he said. "A lot of guys understand that, but some don't. It's probably about 50-50."

Webster predicted that soldiers who are frustrated with the U.S. role will feel differently as the situation in Iraq improves. "Later, when the Iraqis are voting for president, I can tell my grandchildren, 'Yeah, they wouldn't be doing that if it wasn't for us,' " he said.

On Jan. 30, 37 mortar shells and rockets fell on Balad as insurgents tried to disrupt the parliamentary elections. To prevent that from happening again, Petery decided to wage an intimidation campaign of "terrain denial" -- a withering succession of artillery and illumination rounds fired into areas where insurgents were known to position mortars and rocket launchers.

The explosions, which literally rattled the base from which they were fired, began around 10 p.m. Friday and lasted until just before the polls opened at 7 a.m.

Petery said the battalion fired only into remote, unpopulated areas where insurgents were known to stage attacks. "We weren't doing it to kill people," he said. "We were doing it to discourage people who were shooting into Balad and killing people."

Petery said he wanted to continue firing during the referendum but was ordered not to by McKnight, who, he said, was concerned about scaring voters. Petery said a compromise was reached by which McKnight provided additional air support to discourage attacks.

Insurgent activity around Balad during the referendum was limited to a brief small-arms attack on a U.S. convoy. There were no casualties.

Petery, the commander of the 5th Battalion, 7th Cavalry Regiment, which oversees Balad and the surrounding villages, set out shortly after the polls opened Saturday with a dozen soldiers in a convoy of two Humvees and a Bradley.

The convoy headed about 20 miles northwest to Ishaqi, a small Sunni Arab town so dangerous to U.S. troops that the military built a berm around it to limit escape routes. Petery intended to discreetly inspect polling conditions, but he quickly found himself dragged into the referendum.

Outside the polls, dozens of angry Sunnis said they had been turned away because of confusion over where they were supposed to vote. The police chief and an electoral official immediately sought Petery's help, and the three men discussed the issue through an interpreter surrounded by disenfranchised Sunni voters.

The officials asked Petery if his men might be able to move election material to other locations to resolve the problem.

"I'm not allowed to touch the ballots," he said. "It's an Iraqi election."

Petery continued to resist getting involved but finally relented, saying he didn't want to give Sunni Arabs an excuse to say they were prevented from voting.

"The real problem is that people don't know what to do," he told the Iraqi officials. "Somebody needs to take charge and let them know they're fixing the problem."

Obviously angry about getting drawn into the management of the referendum, he returned to the command center on the U.S. base and ordered American soldiers there to work with Iraqi election officials to resolve the problem.

"They have a problem because they didn't publicize the polling sites well enough," he told them. "And now it's my problem."

The situation was finally resolved when the electoral commission, after being alerted to the situation, decided to allow voters to cast ballots at any location in the area.

At the end of the day, Petery ventured into downtown Balad, visiting three polling sites. He was treated as a dignitary; Iraqi police officers and election workers took pictures of him with their cell phones. He toured the sites with the mayor, shaking hands with the election workers and thanking them for their efforts.

His heavily armed men waited in the streets, handing out soccer balls to throngs of children who gathered around them, wide-eyed and smiling.

Petery, exhausted and buoyant that the referendum had gone so well, finally walked back toward his Humvee.

"Now we have to go home and find out how to get those ballots back," he said.