Prince Ernst August of Hanover, the husband of Princess Caroline of Monaco, is suing his son to win back control of a German castle and prevent it from falling into public hands, a court has said.