“The Practice” producer David E. Kelley decided to fire Dylan McDermott, Lara Flynn Boyle and four other actors in a last-ditch effort to save the faltering show.

But the axed stars are smarting over being brought cross-country to tout the show before the New York media — only to be given the boot a week later!

“The stars who have been shown the door all feel betrayed, but Kelley keeps telling them there was nothing he could do,” a source close to the legal drama told The ENQUIRER.

“He says he had to cut costs to keep the show on the air at all, and the only way he could cut costs quickly was to dump some salaries.

“Dylan McDermott made $300,000 an episode and the others added another half-million and more to the cost of each episode.

“‘The Practice’ had been a huge hit on ABC for years but was starting to lose ratings — especially after the network moved it from Sunday nights to the ratings pit of Monday nights.

“ABC paid $6.5 million an episode in licensing fees for the show, and with declining ratings, the network played hardball and told Kelley that if he wanted his Sunday night slot back, he’d have to cut costs in half.

“Kelley doesn’t see what else he could do. If the show ended, dozens of people would be out of work. He says he chose the lesser of two evils.”

The source said Dylan McDermott didn’t help things by seeking a pay increase even as the show was sinking. Camryn Manheim, another longtime regular on the show, offered to take a pay cut — and saved her job, the source disclosed.

“Now Kelley’s going to have to hire unknown actors who are looking for their big break — but he’ll be able to get them for peanuts.”

Also getting the ax were Lisa Gay Hamilton, Marla Sokoloff, Kelli Williams and Chyler Leigh.

“For now the show has survived,” said another source. “But I guarantee the remaining cast will stay on their toes. They won’t be showing up for work late any time soon!”