Five armed men drove a stolen car onto the grounds of Parliament today and killed at least seven people with explosives and gunfire before security forces shot them dead.

Driving a car resembling those used by members of Parliament and wearing military-style uniforms, the attackers easily breached the Parliament complex's outer security cordon but could not penetrate the circular, colonnaded building, where at least 400 lawmakers had adjourned only minutes before.

Lawmakers said quick action by security guards prevented the gunmen from entering. Much of the shooting took place outside the gate used by the vice president, the prime minister and the home minister.

"This is a warning to the entire nation," Prime Minister Atal Bihari Vajpayee, who was not in Parliament at the time of the attack, said in a televised address. "Our fight against terrorism has been going on for the last two decades and has now entered its final, decisive stage."

There was no immediate claim of responsibility for the attack. But Muslim militant groups fighting for control of India's portion of the divided region of Kashmir have carried out several high-profile acts of terrorism in India over the past two years.

Indian officials have accused Pakistan, which supports the Muslim insurgency in Kashmir, of conducting "cross-border terrorism" in the Himalayan region, which is claimed by both countries. The regional rivals, which both possess nuclear weapons, have fought two wars over Kashmir since Pakistan became a separate state in 1947.

While both India and Pakistan have been strong supporters of the U.S.-led campaign against terrorism since Sept. 11, their differences over Kashmir remain profound and have posed a difficult balancing act for Washington policymakers eager to address each side's concerns. The possibility that today's attack could lead to renewed fighting between the two countries could present the United States with a fresh diplomatic dilemma at a time when its military operations in nearby Afghanistan appear to be bearing fruit.

In Washington, President Bush telephoned Vajpayee to express condolences and offer FBI and State Department counterterrorism teams to help investigate.

The State Department denounced the attack as outrageous terrorism. "This brutal assault on the heart of Indian democracy is an attack on all democracies, as well as an attempt to undermine the efforts of those seeking regional peace and stability," spokesman Richard A. Boucher said.

Pakistan also condemned today's attack. In a message to Vajpayee, Gen. Pervez Musharraf, the country's president, said, "I have been saddened by the loss of life and the injuries suffered by Indian security personnel in the attack."

But Indian Home Minister L.K. Advani responded to the attack with a pointed challenge. "The attack will cost the terrorists dear, as the whole nation will be fired up with patriotism after this," Advani said. "We will liquidate the terrorists and their sponsors, wherever they are and whoever they are."

The attack began at 11:20 a.m. when a stolen car with a fake pass and a red light like those used by lawmakers passed unchallenged through a gate in the Parliament complex's outer security wall, according to police and parliamentary sources. The car headed toward the Parliament building, then the five occupants began jumping from the vehicle. One, who had explosives strapped to his body, blew himself up outside the front porch of the building, and the others opened fire on security guards.

In the 40-minute gun battle that followed, four police officers, two paramilitary guards and a gardener were killed before the four remaining attackers were slain, according to parliamentary sources.

When the first gunshots were heard, security guards pushed lawmakers and journalists into offices and conference rooms and locked the doors of Parliament. Army commandos sealed off the complex and halted traffic on major roads in the city. Afterward, the army deployed troops outside the residences of senior leaders, and the city has been sealed and put on high alert.

"I was coming out of Parliament at the time," said one member, Kharabela Swain. "I heard some shots and I thought it was [fire]crackers. I heard somebody shout 'Run! Terrorists, terrorists!'

"Then I saw a man hurl a grenade toward the building and run around the wall. Everybody was running helter-skelter. I also ran. I couldn't think. There was complete chaos."

Parliamentary Affairs Minister Pramod Mahajan, who was inside when the shooting began, said: "Parliament is not just a building. An attack on Parliament is an attack on the heart of Indian democracy."

Today's attack reminded many Indians of another, by suicide bombers on the legislative assembly in Kashmir in early October that killed 38 people. Other recent incidents involving Kashmiri militants include the December 1999 hijacking of an Indian airliner by men demanding the release of accused terrorists and the December 2000 shooting attack at the historic Red Fort here in the Indian capital. Since Sept. 11, suicide bombings have increased markedly in Kashmir.

Advani, the home minister, said last week that statements by a man arrested in Bombay in October indicated there was a continuing threat to the Indian Parliament.

Bombay police say Mohammad Afroz, 26, an Indian Muslim, confessed during two months of interrogation that the original plan for the Sept. 11 terrorist attacks by Osama bin Laden's al Qaeda organization involved simultaneous strikes by hijacking squads on the Indian and British parliaments and the Rialto Towers in Melbourne, Australia, in addition to sites in New York and Washington.

Afroz, whose statements have not been corroborated, told police that even though the London, New Delhi and Melbourne attacks had been thwarted, the buildings were still targets. Afroz is being held in Bombay on charges of criminal conspiracy to cause and abet terrorist attacks.

The brother of a slain policeman cries outside a New Delhi hospital. The attack on Parliament left 12 people dead.Indians point to an armed man inside the Parliament compound in New Delhi.