Federal agents yesterday detained a man they believe is the elusive Unabomber after a brief scuffle outside his hand-built cabin in the deep woods of Montana, apparently ending an intensive and frustrating 17-year search for one of America's most wanted men.

The suspect, under surveillance for several weeks, was not immediately charged, but federal law enforcement officials said he is expected to be accused soon of striking terror across the nation with his carefully crafted pipe bombs. He was identified by neighbors and others as Theodore "Ted" Kaczynski, 53, a reclusive Harvard graduate and former University of California at Berkeley math professor known locally as "the hermit on the hill."

He will probably appear in U.S. District Court in Helena, knowledgeable officials said last night. "It is promising, but there is more work to be done," a federal law enforcement official said of the case.

Authorities have been looking for the Unabomber since 1978, when a bomb exploded at Northwestern University outside Chicago -- the first in a series of reported Unabomber attacks that killed three people and injured 23. The attacks, the last of which occurred in April 1995, were apparently targeted at those he felt were contributing to the advance of modern technology and its dehumanizing effects.

No one was injured in yesterday's scuffle, according to law enforcement sources. FBI and Treasury agents and Postal Service investigators searched the primitive one-room cabin for documentary and other evidence while explosives experts scoured the surrounding property. One official said "bomb-making components" were found in the home.

Officials said they were trying to match DNA they had collected from saliva that helped to affix stamps to packages sent by the Unabomber with more recent samples. In addition, they were searching Kaczynski's property for a typewriter like the one the Unabomber had used.

Kaczynski came under suspicion about a month ago, when his brother found documents in the family's Chicago-area home that prompted him to speak up, law enforcement sources said. The brother contacted the FBI through a Washington, D.C., attorney and then cooperated with authorities as the investigation intensified. All sorts of electronic surveillance techniques, on the ground and from satellites, were used to monitor Kaczynski's activities, the sources said.

"This was a very primitive existence he was living there," one source said. The cabin was in such a sparsely settled area at the edge of the Helena National Forest that one FBI agent spotted a cougar attacking and killing a deer close to the agent's surveillance post.

Kaczynski, a skinny man with blond hair turning gray, built the one-room cabin himself in 1970 or 1971, according to neighbors. It measures 10 by 12 feet and has a root cellar, but no electricity or plumbing. He chopped wood for heat and hunted deer for food. Neighbors would sometimes see him dressed in overalls and a straw hat and riding a bike. He did not appear to have any regular means of employment, and local residents told The Washington Post they assumed that he lived off some family money.

The primitive lifestyle was one factor that enhanced the suspicions of authorities. The Unabomber had intense hatred of modern technology, as he made clear in the 35,000-word manifesto that The Washington Post and the New York Times published jointly last September as a supplement to The Post. He had written to both papers, saying he would halt his attacks if either published his manuscript and warning of more violence if they did not.

In his manifesto, the Unabomber argued that modern society could not be improved and must be destroyed to return to the condition of "wild nature."

Many questions remain if Kaczynski is eventually charged, including how he managed to send off bombs with postmarks far from his Montana cabin. Officials expect to make a formal announcement and discuss the case in Washington today.

The records his brother found were highly suspicious, sources said. Federal authorities had collected many of the documents the Unabomber had sent over the years, which included telltale typewriter marks and initials he was prone to use.

Members of a San Francisco-based task force composed a profile depicting the bomber as someone exposed to science or some related discipline who resided in the Chicago area at one point and later moved to Northern California, where he may have had "some sort of contact" with the University of California at Berkeley. Two bombs were placed in a computer sciences building at Berkeley in 1982 and 1985. It was clear that he knew his way around a college campus.

For much of his deadly career, the Unabomber kept silent about what appeared to be a random campaign against unrelated industries and academic fields. The FBI called him UNABOM because his early targets worked in universities or for airlines. The bomber called himself "FC," for Freedom Club, but the FBI was convinced that this was a one-man organization. The only credible sighting was reported in 1987, outside a Salt Lake City computer store just before an explosion. A witness described him then as a man with curly, reddish-blond hair and a light mustache.

Born on May 22, 1942, Theodore John Kaczynski grew up in the blue-collar suburb of Evergreen Park outside Chicago and went to Harvard in 1958 to study math and physics. He lived at Eliot House there and graduated at age 20 with a liberal arts degree and a math major. He got a doctorate in mathematics from the University of Michigan in 1967, writing a dissertation on a form of complex geometry known as "boundary functions."

Last night, one of his Michigan math professors, Peter Duren, said Kaczynski was meticulous, "even for a mathematician." Duren added, "I was always impressed by him. I had a lot of respect for his talent and his promise."

Duren expressed surprise that authorities suspect his former student as the Unabomber. "The person I knew wouldn't have done this," he said.

After Michigan, Kaczynski went on to teach math at Berkeley for the 1967-68 and 1968-69 school years. He resigned, abruptly it seems, on June 30, 1969, and shortly thereafter moved to Montana.

Kaczynski built his cabin on a hill a few miles outside the little town of Lincoln, in Montana's Lewis and Clark County, some 60 miles northwest of Helena and near the Continental Divide. The site, which was put off-limits yesterday to reporters and camera crews, is hundreds of miles away from an unrelated FBI standoff with an armed anti-government group called the Freemen near Jordan, Mont.

All told, the Unabomber launched 16 attacks, starting with Northwestern. While only one person was killed in the first 14 incidents, his two most recent bombs were lethal: In December 1994 a New Jersey advertising executive, Thomas Mosser, was killed when he opened a bomb mailed to his house, and in April 1995 the president of the California Forestry Association, Gilbert Murray, was killed in his office by a mail bomb addressed to someone else.

At that point, the Unabomber suddenly became voluble, sending letters to newspapers, a former victim and a college professor. Most prominent was his manifesto, which he entitled "Industrial Society and Its Future." A rambling quasi-academic tract in 232 numbered paragraphs and eight pages of notes, it is an indictment of what he calls the "impersonal," "anti-individualistic" and "destabilizing" nature of modern society.

To the Unabomber, the underlying reason for our woes is the loss of autonomy. "{M}odern man," he wrote in the manifesto, "has the sense (largely justified) that change is IMPOSED upon him whereas the 19th century frontiersman had the sense (also largely justified) that he created change by himself. . . . "

That loss of autonomy, he contended, was all but inevitable with the march of technology and its labor-saving devices, steering people toward "those drives that can be satisfied with minimal effort," such as spectator sports, or those that cannot be satisfied at all, such as dreams of great wealth.

The Unabomber's burst of public pronouncements may have been spurred by the bombing of the federal building in Oklahoma City last April. This, officials said, "seemed to tweak him" and prompt him to say, in effect, "Hey, Oklahoma City may have been the biggest bomb, but I'm still here and you can't catch me."

He mailed a threat last June to the San Francisco Chronicle, warning that he was planning to blow up an airliner out of Los Angeles International Airport. It was the first time the bomber had threatened a target in advance.

The threat led to extraordinary security measures at California airports and temporarily held up air mail to and from the state. Then, the Unabomber sent a letter to the New York Times declaring the initial threat to have been a hoax. The Times published portions of that letter, in which he called the threat "one last prank."

He delivered his manuscript to the Times and The Post around the same time, calling for worldwide revolution against the effects of modern society's "industrial-technological system."

After deliberations that lasted nearly three months, the two newspapers agreed to publish the text in a special section of The Post last Sept. 19 "for public safety reasons." The controversial decision came after the publishers of the two papers, Donald E. Graham of The Post and Arthur O. Sulzberger Jr. of the Times, met with Attorney General Janet Reno and FBI Director Louis J. Freeh.

"We thought there was an obvious public safety issue involved and therefore sought the advice of responsible federal officials," Graham said at the time. "We are printing it for public safety reasons, not journalistic reasons."

The documents Kaczynski's brother found were reminiscent of the manifesto, law enforcement sources said, and prompted the FBI to conduct a further search of the Kaczynski family home in Lombard, Ill., a Chicago suburb. The bureau began intense surveillance of the Montana cabin in bitterly cold weather and heavy snow. Kaczynski himself had not left the cabin area since the monitoring started, law enforcement officials said. In any case, he was not an intimidating figure when he did venture out.

"He was soft-spoken and distant, almost too reserved. He really didn't talk that much," Mary Wilson, who delivered wood to Kaczynski's cabin, told The Post. Staff writers Curt Suplee in Washington and Jacqueline L. Salmon in Michigan contributed to this report. CAPTION: 3 DEAD, 22 INJURED

Since the first UNABOM package exploded in 1978, 15 blasts have killed three people and wounded 23. Incidents linked to the Unabomber:

April 24, 1995: California Forestry Association President Gilbert P. Murray, 47, killed opening a mail bomb in the group's Sacramento headquarters.

Dec. 10, 1994: Advertising executive Thomas Mosser, 50, killed by bomb sent to his North Caldwell, N.J., home.

June 24, 1993: Yale University computer scientist injured in office.

June 22, 1993: Geneticist at University of California at San Francisco injured by bomb sent to his home.

Feb. 20, 1987: Man injured by bomb left behind computer store in Salt Lake City.

Dec. 11, 1985: Hugh Scrutton, 38, killed by bomb found near his computer rental store in Sacramento.

Nov. 15, 1985: Two people injured by package mailed to professor at University of Michigan at Ann Arbor.

June 13, 1985: Package mailed to Boeing Co. in Auburn, Wash., is discovered and safely disarmed.

May 15, 1985: One person injured by bomb found in computer room at University of California at Berkeley.

July 2, 1982: Professor of electrical engineering and computer science injured in faculty lounge at University of California at Berkeley.

May 5, 1982: One person injured at Vanderbilt University in Nashville; package addressed to a professor.

Oct. 8, 1981: Bomb placed in a business classroom at University of Utah in Salt Lake City. No one injured.

June 10, 1980: United Airlines president injured at home in Chicago area.

Nov. 15, 1979: Twelve suffer smoke inhalation when bomb explodes in plane's cargo hold during American Airlines flight, forcing emergency landing at Dulles International Airport.

May 9, 1979: One person injured at Northwestern University.

May 25, 1978: Package found in parking lot at University of Illinois at Chicago and brought to Northwestern University in Evanston because of the return address. Explodes when opened on May 26, injuring one person. CAPTION: Police sketch of Unabomber. CAPTION: Thomas Mosser, killed in 1994. CAPTION: Yale University professor David Gelertner, injured in 1993. CAPTION: Security guards patrol grounds at Evergreen Park High School in Illinois, which Theodore Kaczynski attended in 1950s. CAPTION: Police Detective Ron Muersch displays 1958 high school yearbook from Evergreen Park., Ill., where he and Theodore Kaczynski were classmates.