The decision was made by Fox and creator David E. Kelley agreed, a source close to the show said, speaking on condition of anonymity. Kelley made the announcement on the set Wednesday.
"There were tears. It was emotional," said 20th Century Fox Television spokesman Chris Alexander. The final episode of the series, which had slipped in the ratings, will air May 20.
"It's sad to say goodbye to something you love, even when perhaps it is time," Kelley said in a statement.
He remains a force in television with "The Practice," "Boston Public" and the new "girls club" — about three female lawyers in San Francisco — on Fox's schedule for next season.
Calista Flockhart starred as Ally, a smart but emotionally needy lawyer who focused as much on her love life as her case load. With her biological time clock ticking, she was bedeviled by an image of a dancing baby.
"Ally McBeal" became a hot water-cooler topic. In 1998, a Time cover displayed Flockhart opposite feminist icons such as Susan B. Anthony and asked in its headline: "Is Feminism Dead?"
The actress took exception.
"I mean, this is a comedy about an exaggerated character, and to compare her to Susan B. Anthony is outrageous," she told TV Guide at the time. She also said she was offended that people confused her with her neurotic character.
McBeal's colleagues at her fictitious Boston law firm were equally quirky. One man had a fetish for throat wattles; another went by the embarrassing name of "The Biscuit."
Kelley, one of Hollywood's most prolific TV writer-producers, had a hand in creating most of the scripts. The show reflected his offbeat, often dark sense of humor and romance. It won the best comedy series Emmy in 1999.
Kelley had characters break out in courtroom song, had Ally visit with her dead boyfriend, Billy, and generally created a world where fantasy, if not happy endings, ruled.
McBeal's great love was portrayed by Robert Downey Jr., whose own real-life troubles with drugs led to his departure from the show.
Musical stars were also a fixture of the show, with Elton John, Barry White, Barry Manilow, Mariah Carey and others making guest appearances.
Kelley, a former Boston lawyer who is married to actress Michelle Pfeiffer, told The Associated Press last fall that he knew the character-driven "Ally McBeal" was a more perishable commodity than his other legal series, ABC's more plot-oriented "The Practice."
"I always thought the series would end after six years," he said then.
Fox and Kelley decided against another year as the ratings fell. The show, which once scored close to the top 20, recently finished 43rd in the ratings.