"The judge said, 'Enough is enough'," Hasselhoff said outside court after a hearing.
Hasselhoff was awarded primary physical custody and full legal custody of the two girls, said his lawyer Melvin Goldsman.
The girls will live mainly with their father, who will have responsibility for making decisions about their health, education and welfare, Goldsman said.
"We're all gratified with the court's decision today, and David looks forward to moving on and living his life with his children," the lawyer said.
Bach and her lawyer, Debra Opri, declined to talk about the case in detail as they left the courthouse, saying they were prevented from doing so by a court order.
"We're feeling good. The system works," Opri said.
"The truth will be told," Bach said when asked about Hasselhoff's statements.
Hasselhoff, 54, the former star of TV's Baywatch and Knight Rider, and Bach, 43, had been splitting custody of their daughters, Hayley, 14, and Taylor, 17.
On May 7, Los Angeles Superior Court Judge Mark Juhas put a hold on Hasselhoff's visitation privileges for two weeks.
The decision came within days of the public leak of a videotape showing an apparently drunken Hasselhoff struggling to eat a cheeseburger while on the floor of his Las Vegas home.
One of his daughters is heard chastising him.
His visitation rights were later restored.
Hasselhoff told the TV show Extra that he was humbled by the support he received after the videotape aired.
Outside court today, he said the media attention surrounding the case had been difficult.
"We're all gonna deal with our issues," he said. "We're all gonna get through life and hopefully spend the rest of this glorious, blessed day on the beach."
Hasselhoff, a recovering alcoholic, had been living in Nevada while appearing in the Las Vegas production of The Producers. He has also resumed his judging job on the TV show America's Got Talent.
Hasselhoff and Bach were married in December 1989. He filed for divorce in January 2006 and their divorce was final last August.
AP