Freedom to preach upheld in court