Martha Stewart was sentenced Friday to five months in prison for obstructing a federal securities investigation, then marched outside the courthouse to declare that "a small personal matter" had been blown out of proportion and urge supporters to stick with her company's products.

The multimillionaire businesswoman, who must also serve five months in home confinement and two years under supervision by the probation office, got the lightest sentence possible under federal guidelines. Her former broker Peter E. Bacanovic, who was convicted with her in March of obstruction of justice, conspiracy and lying to federal investigators, received the same terms of confinement in a separate proceeding later in the day. Stewart must pay a $30,000 fine and Bacanovic $4,000.

U.S. District Judge Miriam Goldman Cedarbaum said both Stewart, 62, and Bacanovic, 42, can remain free on bond while they appeal their convictions, which could take more than a year.

The share price of Martha Stewart Living Omnimedia Inc. shot up 37 percent on Friday's news, but remains well below where it was before the news broke that Stewart's December 2001 sale of ImClone Systems Inc. stock was under investigation.

Stewart, who built a catering business into a multimedia empire, was a study in contrasts as she broke two years of nearly total silence about the scandal.

In the courtroom, Stewart told the judge in a shaking voice: "Today is a shameful day. It is shameful for me, for my family, and for my beloved company and all of its employees and partners. What was a small personal matter became over the last 21/2 years an almost fatal circus event of unprecedented proportions spreading like oil over a vast landscape. . . . I have been choked and almost suffocated to death."

She then asked the judge to "remember all the good that I have done, all the contributions I have made. . . . My hopes that my life will not be completely destroyed lie entirely in your competent and experienced and merciful hands."

But after exiting the courthouse to cheers of "We love you Martha" from two dozen supporters, Stewart took a far more defiant tone, as she repeated much of the statement she made to the judge.

Saying more than 200 people lost jobs at her company "as a result of this situation," Stewart said, " I want them to know how very, very sorry I am for them and their families."

She thanked the 170,000 people who she said have written to her personal defense Web site and urged them to help the company by subscribing to her magazines, lobbying the advertisers and buying her products.

"I don't want to use this as a sales pitch for my company, but we love that company, we've worked so hard . . . and we really think it merits great attention from the American public," she said.

Stewart then promised, "I will be back." Stewart has asked to serve her prison time in Danbury, Conn., and home confinement in Bedford, N.Y.

Later in the day, Stewart posted on the Web site a letter she had written to Cedarbaum, a video-recorded statement and a note to fans that called the sentence "horrendous . . . but not unexpected." She added, "I am not afraid of what the future holds."

Stewart's case has been one of the highest-profile and most hotly debated white-collar crime cases ever since news of the insider trading investigation became public in June 2002. Her supporters said she was unfairly singled out because of her celebrity and because of bias against female executives. Prosecutors said they brought the case because no one could be allowed to interfere with a federal investigation.

Assistant U.S. Attorney Karen Patton Seymour echoed that view at Friday's hearing, when she urged Cedarbaum not to make a special exception for Stewart, as defense lawyers had asked, and go below the recommended minimum sentence.

"This is a serious offense and it has broad implications for the administration of justice," Seymour said. "The sentence should also reflect the even-handedness of our criminal justice system."

During the five-week trial, prosecutors contended that Stewart unloaded 3,928 ImClone shares because Bacanovic's assistant Douglas Faneuil improperly tipped her that the company's founder, Samuel D. Waksal, was trying to dump his stock. Bacanovic and Stewart told investigators that they had previously arranged to sell the stock if the price fell below $60, which it did on the day she sold. Faneuil pleaded guilty to a misdemeanor and became the government's star witness. He is scheduled to be sentenced next week.

The trial shed an unflattering light on Stewart, who was described by witnesses as rude to subordinates and penny-pinching to the point of trying to bill her company for haircuts and weekend trips.

Her lawyer Robert G. Morvillo referred to the negative publicity as he asked Cedarbaum to grant his client probation.

"The punishment should fit the crime," Morvillo said. "Here, unlike so many white-collar cases, no one has lost money, no fraud occurred. . . . [Stewart] has been scorned, ridiculed and become the butt of all forms of derogatory publicity. . . . Her assets have been substantially depleted."

During home confinement, Stewart will be allowed to go to work and other approved activities for up to 48 hours a week. She must spend at least one entire day a week at home. The judge said she would consult with the probation office about Stewart's request that she not be required to wear an electronic monitoring bracelet during home confinement.

At his afternoon hearing, Bacanovic told the judge: "I deeply regret the pain and sorrow this case has caused my family. . . . This has been a horrible ordeal."

Cedarbaum then handed down the same confinement terms but a smaller fine. "Lying to government agencies during the course of an investigation is a very serious matter," the judge said as she sentenced each defendant. "A term of incarceration is justified and appropriate in this case."

Cedarbaum added that she was imposing the minimum guidelines sentence because neither had a prior record and both had done much good for other people.

"The public interest objective in this prosecution has been served by the jury verdict," the judge said. "You have suffered and will continue to suffer enough."

Outside the courthouse, Stewart's appeals lawyer Walter Dellinger, of the District, outlined what he said were five promising avenues for Stewart's appeal.

Among them: the allegation that one juror lied on his jury questionnaire and was biased against Stewart, the recent arrest of a government ink expert on charges he lied during the trial, Cedarbaum's refusal to allow Morvillo to argue that Stewart was not guilty of insider trading and therefore had no reason to obstruct the investigation, and the claim that the jury's verdict was tainted by hearing the evidence connected to a securities fraud count that Cedarbaum dismissed right before closing arguments.

In her recorded Web message, Stewart told supporters "the trial was fundamentally unfair in so many different ways and this will be the basis of my appeal."

Bacanovic will base his appeal on the alleged perjury by the witness and the juror and will likely argue that he should not have been tried alongside Stewart.

The appeal is not the only legal proceeding in Stewart's and Bacanovic's future. The Securities and Exchange Commission has filed civil insider trading charges against both, alleging that the tip about Waksal violated securities laws. The SEC is seeking monetary damages and for Stewart to be barred from serving as director of a public company and her activities as an officer to be limited.

Stewart's company has been severely wounded by her legal woes. While supporters continue to buy her magazines and retail products, advertisers have deserted her magazines, particularly the flagship Martha Stewart Living, in droves. Stewart, who resigned as chief executive when she was indicted and left the board after her conviction, still owns a controlling interest. The company's shares closed at $11.81, up $3.17, or nearly 37 percent. The company was trading above $19 a share before reports of the investigation leaked to the media.

Friday, the company issued a statement saying Stewart "has our full support. . . . We see this as an important step toward closure."

Legal experts said Stewart was extremely lucky in her sentencing. Since Enron Corp. collapsed in late 2001, many judges have been reluctant to be seen as soft on white-collar criminals and Congress has been inveighing against judges who drop below the minimum recommended sentence. As a result, Stewart's request for probation was always a long shot, they said, and she ran the chance of getting up to 16 months in prison.

Martha Stewart took a more defiant tone in her speech to supporters outside the courthouse than she had inside it, even while repeating much of the statement she had read the judge. Martha Stewart was ordered to serve five months in prison, followed by five months of home confinement and two years of probation -- the lightest sentence under federal guidelines. She is appealing the verdict.