TMZ has obtained a copy of a complaint against Dr. Phil which was lodged with the California Board of Psychology, alleging the TV doc was illegally practicing without a license when he paid a visit to one Britney Spears.

We've learned the person who filed the complaint is a psychologist. Dr. Phil has never been licensed to practice in California, and he retired his Texas license in 2006.

The shrink believes when Dr. Phil visited Brit in the hospital earlier this month, he was practicing psychology. A "Dr. Phil" honcho told TMZ the visit was never meant to lure Britney onto the TV show -- and that there were never plans to put her on the air.

A Psychology Board rep told TMZ if the Board finds the complaint credible, it would be referred to the D.A. for review. Practicing without a license is a felony in California.

The psychologist who filed the complaint also alleges Dr. Phil violated HIPAA laws by "discussing or divulging a patient's medical condition ... with the media," in reference to a press release issued by Dr. Phil.

The complaint also says, "A petition is being circulated to remove the "Dr. Phil" show from the air." We're told the shrink is trying to get other psychologists to sign.