The trick was to fly at warp factor 12 around an exact duplicate of the United States Constitution, flinging the Enterprise far back enough in time that the Romans didn’t have submachineguns anymore. Then a simple application of aerosolized Cordrazine in the atmosphere allowed the people to realize they had no need for gods.