Anyone who failed to grasp the lessons of the Martha Stewart case needs to learn about Eric I. Tsao.

Tsao used to be a vice president of MedImmune Inc., the Gaithersburg biotech company.

Now he faces up to 10 years in prison for insider trading and lying to Securities and Exchange Commission lawyers who were investigating him.

Like Stewart, Tsao wouldn't be facing prison if he had told the truth.

Like Stewart, he's turned a minor wrongdoing -- one that's often not even considered criminal -- into a major offense.

Court documents show that Tsao twice got away with trading on inside information, funneling his trades through a Charles Schwab account in the name of his father, who lives in Taiwan.

The third time he tried, Tsao's Taiwan address failed to hide him from stock market regulators who were working within walking distance of his office.

Until MedImmune moved to a new building a few months ago, its headquarters was in the same Montgomery County office park as the market surveillance division of NASD Regulation, the private regulatory agency that oversees trading on the Nasdaq Stock Market.

When Tsao sat at his office computer and typed in an order for 10,000 shares of Aviron, a company MedImmune was negotiating to buy, he left an electronic trail for regulators to follow.

When MedImmune's deal to buy Aviron was announced in December 2001, computers at the NASDR kicked on as they always do and began scanning, trade by trade, all the buying and selling of stocks of both companies. One of the trades they spotted was traced to Tsao, who made $146,000 after he sold his Aviron stock less than a month after he bought it.

Exactly what made Tsao's trade stand out, NASDR officials won't say, but they do say that they began their investigation the day after MedImmune's acquisition of Aviron was announced. Within a few weeks, Tsao's name was on a list of accounts that were under investigation.

The electronic trading trail showed that Tsao bought 10,000 shares of Aviron the day after Thanksgiving 2001. A few days later, MedImmune announced plans to buy Aviron in a $1.6 billion stock swap and the shares jumped from about $35 apiece to more than $50.

As the computer searching technology known as "data mining" has become more sophisticated, it has gotten better at spotting suspicious trading, said Cameron K. Funkhouser, senior vice president for market regulation at the NASDR.

"History has shown certain scenarios where there is traditionally insider trading," he said. "Our technology is looking for patterns of behavior in the stocks that suggests to us, under different scenarios, potential insider trading or potential fraud."

Mergers and acquisitions are at the top of the list of situations in which insider trading can occur, so every merger triggers a review of the action in the stocks of the companies involved, Funkhouser said.

Obviously, big trades just before a deal is announced will set off the alarms. How big is one question Funkhouser won't answer. "People try to stay under the radar screen," he said. "It doesn't work."

The investigation begins with gathering basic data. From brokerage, the NASDR gets lists of accounts that were trading the stock. From the companies involved, the regulators get detailed timelines of when merger talks began and who, at each step of the process, knew what was going on. Company executives, lawyers, investment bankers, even the clerks who type documents are looked at, their names and addresses checked against stock trading records. Meanwhile, names that turn up on lists of suspicious trades are taken to the companies, to see if any of them are recognized.

Funkhouser's team of regulators has dozens of these insider trading investigations going on every day. Most of them don't turn up anything. But they score two or three times a week, referring about 150 cases a year to the Securities and Exchange Commission.

It's the SEC that actually prosecutes insider trading cases. When they become a criminal matter, as they did in Tsao's case, the SEC turns them over to the Justice Department.

Most of the time, insider trading is not treated as a crime. It is a civil violation of securities laws, handled by a civil lawsuit against the violator. The vast majority of those cases are settled by plea bargaining. The typical punishment in a civil insider trading case is a fine and repayment of any ill-gotten gain. People who work in the securities business are often banned from the industry, temporarily or permanently, for insider trading. People who are officers or directors of public companies are usually barred from serving in such posts.

But basically, first offenders who get caught doing insider trading are forced to give back the money and to promise to never do it again. Rarely do they go to jail.

Martha Stewart and Eric Tsao made themselves exceptions to that rule.

Stewart was convicted of lying to federal agents who were investigating whether she had inside information when she sold shares of the biotech firm ImClone Systems Inc. just before the announcement that the company's new cancer drug had not been approved by the Food and Drug Administration. Stewart was never actually charged with insider trading, but is facing five months in prison for obstructing justice.

Tsao eventually pleaded guilty to insider trading and perjury. He tried to tell government agents that his wife had made one of the trades, coming into his MedImmune office, signing on to his company computer and placing the order. Later he admitted that was false.

Court documents reveal that when Tsao learned that he was under suspicion, he tried to cover his tracks. He called Schwab, pretending to be his father, to ask whether the firm kept e-mails and records of trades. The firm not only keeps them, it routinely records phone calls from customers to provide a backup record of a transaction. Investigators got not only the trading records, but the phone calls.

When they began studying Tsao's trading records, investigators uncovered two other instances of insider trading.

In 1999, Tsao bought 6,000 shares of U.S. BioScience Inc. after learning that MedImmune was in merger talks with that Pennsylvania company, which was developing drugs to treat AIDS and cancer. The $400 million acquisition was announced about a week after Tsao bought the stock. Within two weeks, Tsao sold the shares for an $18,000 profit.

In 2000, Tsao found out that MedImmune was negotiating to manufacture a cancer drug for ImClone -- the very same company involved in the Martha Stewart case. Counting on the deal to buy both stocks, Tsao bought 2,000 shares of ImClone and 2,000 shares of MedImmune. The drug manufacturing deal eventually fell through, but Tsao sold his ImClone stock several months later for a $50,000 profit.

Those two transactions radically revised the context of the case that originally brought Tsao to the attention of NASDR and the SEC. He wasn't just a scientist who couldn't resist one chance to make some quick money. He was a three-time insider trader who had lied to investigators.

Do it once and there's a good chance you'll walk away with a fine and a slap on the wrist. Three times plus perjury and you're referred to the Justice Department for a criminal prosecution. Criminal insider trading means jail time, a sentence of up to 10 years in federal prison. The perjury count, which parallels the crime of which Martha Stewart was convicted, carries a maximum five-year sentence, though Stewart got only five months.

Tsao's lawyer did not return calls and e-mail requests for comment.

Stewart is expected to surrender within the next few days to begin serving her sentence.

Tsao won't be sentenced until January.

The federal prison system is segregated by sex, so Stewart and Tsao won't have an opportunity to meet while they're serving their time. Too bad; they'd have a lot to talk about and a lot of lessons to teach anyone else who is tempted by an insider stock tip.

U.S. Attorney Thomas DiBiagio, right, prosecuted Eric Tsao after the case grew from a civil to a criminal proceeding.