KABUL, Afghanistan — President Hamid Karzai took the helm Tuesday of a country whose revival is threatened by a surging opium trade and a persistent Taliban insurgency, pledging to bring stability and prosperity to Afghanistan even as rebels staged attacks near the Pakistani border.

With the speeches over and foreign dignitaries departing his solemn swearing-in ceremony, the affable Karzai begins a challenging five-year term under pressure to heal ethnic divisions and repair the war-ravaged nation’s decrepit infrastructure.

Before 600 guests who included Vice President Dick Cheney and Defense Secretary Donald Rumsfeld, Karzai outlined his agenda to meet Afghans’ sky-high expectations.

He singled out America — which still has 18,000 soldiers in Afghanistan and is providing billions of dollars in aid — for thanks, while underlining the need for international support.

“Our fight against terrorism is not yet over,” he said, warning of a deadly nexus between extremists and drug traffickers.

International forces mounted their biggest security operation since the Oct. 9 election. Still, rebel assaults before dawn near the Pakistani frontier provided a reminder of the threat to the country’s stability.

Suspected Taliban rebels armed with assault rifles and rockets attacked a military base in Khost province, sparking a firefight that killed four Afghan soldiers and at least six militants, an Afghan commander said.

Also in Khost, insurgents fired on a U.S. patrol, which shot back and killed two of the assailants, a U.S. spokesman, Maj. Mark McCann, said. No Americans were reported hurt.

An effort by militants to fire a rocket at Kabul late Monday was less successful, a NATO spokesman said. The rocket landed harmlessly on a cattle farm outside the city limits.

Cheney, the most senior American official to visit Afghanistan since the Taliban regime was ousted three years ago, met briefly with Karzai and emerged to laud him as a wise leader and an admired international statesman.

Earlier, the vice president told a group of U.S. soldiers, “For the first time the people of this country are looking confident about the future of freedom and peace.”

Rumsfeld, who like Cheney left Afghanistan Tuesday evening, cautioned that the military mission is not over.

“There are still groups, extremists, that would like to take this country back — the Taliban, the al-Qaida — and use it for a base for terrorist activities around the world as they did on 9/11. But it’s not going to happen,” Rumsfeld told a group of special forces soldiers at Bagram Air Base, north of Kabul.

Still, critics say the focus on holding elections and searching for Osama bin Laden have diverted energy from rebuilding Afghanistan’s institutions and clearing the country of weapons to weaken the power of warlords and lessen the danger of ethnic divisions exploding once foreign forces leave.

Karzai’s aides insist no warlords will be in his new Cabinet, which is to be announced within the next week. But many of the faction leaders who were tainted by their role in Afghanistan’s brutal civil wars and still hold sway over remote provinces were prominent at the president’s inauguration.

Hakim Dadwal, a 30-year-old farmer who said he had come from Khost province to celebrate Karzai’s installation expressed the hopes and anxieties of many ordinary people.

“It’s a very important day, and I want to congratulate each and every Afghan,” he said, taking a break from a bout of traditional Afghan dancing in a Kabul square. “After 22 years of fighting, we see the sun rising in Afghanistan.

“But I still want the warlords to give up their weapons, big and small. We have very bad memories of the past times, when there was a gun in every hand.”

Violent police encounters in California last year led to the deaths of 157 people and six officers, the state attorney general’s office said Thursday in a report that provides the first statewide tally on police use-of-force incidents.

At 6:03 p.m. Wednesday, police responded to reports of the robbery at the facility, 2301 Bancroft way, and learned that a man who snuck into the facility and began prowling through the building, taking cell phones and wallets from victims.

Investigators’ efforts to solve the case led to the arrests of Pablo Mendoza, 25, of Hayward, Brandon Follings, 26, of Oakland and Valeria Boden, 26, of Alameda, the Alameda County Sheriff’s Office said Thursday.