LONDON, FEB. 7 -- Prime Minister John Major and Britain's war cabinet narrowly escaped injury today when a mortar shell fired from a nearby van exploded in the back yard of his official Downing Street residence, just 40 feet from the room where he and his senior cabinet colleagues were meeting.

The attack, which took place in the midst of one of the highest security alerts in British history because of the Persian Gulf War, was carried out by the Irish Republican Army and had no direct link to the conflict. It was launched from Whitehall, the main artery of central London's government district and one of the city's most heavily guarded streets.

Security experts said they believed the IRA attack may have been an attempt to capture world attention already heightened by the war. But the organization, which claimed responsibility for the attack in a statement tonight, said it had been planned long before the conflict and before Major took office last November.

The explosion shattered bombproof windows in the ground-floor room where Major and other officials were meeting but injured none of them. "We were sitting in the Cabinet Room when the windows came in," a breathless Foreign Secretary Douglas Hurd told reporters afterward. Officials said Major coolly told colleagues, "I think we had better start again somewhere else," and adjourned the meeting to an underground conference room. Major later told the House of Commons that the timing of the attack was clearly "a deliberate attempt both to kill the cabinet and to do damage to our democratic government."

The assault was the IRA's first attempt to assassinate a British prime minister since it came within inches of killing Margaret Thatcher, Major's predecessor, with a bomb planted in a Brighton hotel in October 1984, and it led to immediate calls for increased security measures from members of Parliament.

The attack took place shortly after 10 o'clock this morning when a white van pulled up at the corner of Whitehall and Horseguards Avenue, about 200 yards north of Downing Street. One by one, witnesses said, three mortar shells were fired through the open roof of the van, after which the vehicle burst into flames.

None of the witnesses who spoke to reporters recalled seeing anyone fleeing the van, although police said later that a man had escaped on the back of a motorcycle driven by another man. They said the attackers had the advantage of a thick snowstorm, unusual for this region, which kept Whitehall relatively empty of cars and pedestrians and hindered visibility.

Two of the shells overshot Downing Street and landed harmlessly in an open lawn west of the Foreign and Commonwealth Office, which adjoins Downing Street. But the third exploded in the walled rear garden of No. 10, the prime minister's office and official residence. Inside, Major was holding his daily session with the war cabinet, which includes Hurd, Chancellor of the Exchequer Norman Lamont, Defense Secretary Tom King and other senior officials.

The explosion shattered windows and scorched a wall of the building, along with Lamont's official residence at No. 11 and chief whip Richard Ryder's office at No. 12.

"It was an almighty explosion," said a senior aide to Major. "There was a loud bang and a very cold draft. We looked around, saw no one was hurt, then we just got the hell out of there quickly." Four people outside were slightly injured, including a Downing Street office worker who was hit in the head by flying glass and two policemen who suffered cuts and bruises.

Major chaired the rest of the war cabinet session this morning, followed by a full cabinet meeting. This afternoon he made his usual biweekly appearance before the House of Commons, telling lawmakers, "The IRA's record is one of failure in every respect. . . . It is about time they learn that democracies cannot be intimidated by terrorism."

But security analysts said the IRA would consider the attack a success because of its public impact. David Capitanchik of Aberdeen University called the assault "a very, very staggering blow at the heart of our government. . . . Their prime aim is to gain the maximum publicity, and they've certainly done that. It is a most spectacular action."

In its statement tonight in Belfast, the IRA said: "Whether the gulf war goes on for weeks or years, let the British government understand that, while nationalist people in {Northern Ireland} are forced to live under British rule, then the British cabinet will be forced to meet in bunkers."

The attack marked the first time the IRA has used mortars in England, but the homemade devices, which often fire wildly or self-destruct, have been a common weapon in the group's long campaign to oust Britain from Northern Ireland.

Police said the white van used today had been purchased in London last July by three men who paid with cash. Part of the roof had been cut away, then carefully retaped into place. The tape had been painted white. The three mortars were 3- to 4-foot metal tubes, stuffed wth high explosive, that had been bolted to the floor of the van, according to police, who believe they were fired by a timing device or by remote control.

"It was a well-planned operation, but one that was badly executed," said George Churchill-Coleman, commander of Scotland Yard's anti-terrorist squad.