US forces officially ended combat operations in Iraq last August but have come under increasing fire in recent weeks. Fourteen US service members were killed in hostile incidents in June, the highest monthly toll in three years.

US officials blame militias armed by Iraq’s neighbor Iran for most of the recent attacks.

At least three US service members have been killed this month, including one on Sunday, the day Panetta arrived in Baghdad on his first trip to Iraq as defense secretary.

Washington still has about 46,000 troops in Iraq more than eight years after the 2003 invasion overthrew dictator Saddam Hussein but is scheduled to withdraw its forces by year-end under a security pact between the two countries.

“We are very concerned about Iran and the weapons they are providing to extremists here in Iraq,” Panetta said in an address to US troops in Baghdad. “In June we lost a hell of a lot of Americans as a result of those attacks. And we cannot just simply stand back and allow this to continue to happen...”

Panetta said Washington’s first effort would be to press Iraq to go after groups responsible for the attacks.

“Secondly, to do what we have to do unilaterally, to be able to go after those threats as well, and we’re doing that,” he said, referring to the right of US forces to defend themselves on Iraqi soil.

Gen. Lloyd Austin, the commander of US forces in Iraq, declined to comment on what specific measures unilateral action might involve.

“I think what the secretary was pointing to was we’ll do what’s necessary to protect ourselves and that could include a host of things... so we’ll just leave it at that,” Austin said.

US forces in Iraq now operate largely in the background, training and assisting Iraqi police and soldiers against a weakened but still lethal insurgency that launches hundreds of attacks each month.

Hours after Panetta’s arrival, militants fired three Katyusha rockets into Baghdad’s heavily fortified Green Zone, home to the massive US embassy complex and Iraqi government buildings, according to an Iraqi Interior Ministry source.

US officials including Panetta have been pressing Baghdad to decide whether it wants US forces to stay beyond the year-end deadline. Maliki has said he will abide by a decision of the majority of Iraq’s political leaders.

In language reminiscent of the Bush era, Panetta appeared to link the Iraq war to the Sept. 11, 2001 attacks in his comments to troops.

“The reason you guys are here is because on 9/11 the United States got attacked, and 3,000... innocent human beings got killed because of Al-Qaeda,” Panetta said. “And we’ve been fighting them as a result.”

He clarified to reporters he was not talking about the justification for the invasion — intelligence, later proven wrong, that Saddam Hussein had weapons of mass destruction.

Instead, he said it was the fact that in the years since Al-Qaeda had “really developed a presence here.”