His speech also echoed other robust defenses of Christianity in politics and education that he has delivered during his first year as attorney general. In October, he said that “the forces of secularism” had unleashed “immense suffering, wreckage and misery” as they sought to destroy religious life in America.

Under his leadership, the Justice Department supported parents in Maine who sued in an effort to force the state to include religious schools in its tuition-funding program. And the department applauded a federal appeals court ruling that upheld the Trump administration’s ability to deprive clinics that provide abortion referrals of federal funds.

Former Justice Department officials and lawyers have publicly criticized Mr. Barr’s remarks about the role of religion in America, and current department employees have quietly grumbled about them. But his unapologetic calls for more faith in public life have made him a hero of the religious right, which has long hoped that the federal government would steer the country away from cultural changes like secularism and greater acceptance of L.G.B.T. people.

The ardent criticism and praise that Mr. Barr has garnered also makes him indicative of the deep divide between those who see religion as a core American value and the heart of the country’s democracy and those who believe that placing religion at the center of law enforcement, policymaking and politics violates the nation’s tenet to separate church from state.

“Moral values must be based on authority independent of man’s will. In other words, they must flow from a transcendent Supreme Being,” Mr. Barr said on Wednesday. “Men are far likelier to obey rules that come from God than to abide by the abstract outcome of an ad hoc utilitarian calculus.”