To see the problem, imagine playing God with the cosmos. Before you is a designer machine that lets you tinker with the basics of physics. Twiddle this knob and you make all electrons a bit lighter, twiddle that one and you make gravity a bit stronger, and so on. It happens that you need to set thirtysomething knobs to fully describe the world about us. The crucial point is that some of those metaphorical knobs must be tuned very precisely, or the universe would be sterile.

Example: neutrons are just a tad heavier than protons. If it were the other way around, atoms couldn't exist, because all the protons in the universe would have decayed into neutrons shortly after the big bang. No protons, then no atomic nucleuses and no atoms. No atoms, no chemistry, no life. Like Baby Bear's porridge in the story of Goldilocks, the universe seems to be just right for life. So what's going on?

The intelligent design movement has inevitably seized on the Goldilocks enigma as evidence of divine providence, prompting a scientific backlash and boosting the recent spate of God-bashing bestsellers.

Fuelling the controversy is an unanswered question lurking at the very heart of science - the origin of the laws of physics. Where do they come from? Why do they have the form that they do? Traditionally, scientists have treated the laws of physics as simply "given", elegant mathematical relationships that were somehow imprinted on the universe at its birth, and fixed thereafter. Inquiry into the origin and nature of the laws was not regarded as a proper part of science.

But the embarrassment of the Goldilocks enigma has prompted a rethink. The Cambridge cosmologist Martin Rees, president of The Royal Society, suggests the laws of physics aren't absolute and universal but more akin to local bylaws, varying from place to place on a mega-cosmic scale. A God's-eye view would show our universe as merely a single representative amid a vast assemblage of universes, each with its own bylaws. Rees calls this system "the multiverse", and it is an increasingly popular idea among cosmologists. Only rarely within the variegated cosmic quilt will a universe possess bio-friendly laws and spawn life. It would then be no surprise that we find ourselves in a universe apparently customised for habitation; we could hardly exist in one where life is impossible. If Rees is right, the impression of design is illusory: our universe has simply hit the jackpot in a gigantic cosmic lottery.

The multiverse theory certainly cuts the ground from beneath intelligent design, but it falls short of a complete explanation of existence. For a start, there has to be a physical mechanism to make all those universes and allocate bylaws to them. This process demands its own laws, or meta-laws. Where do they come from? The problem has simply been shifted up a level from the laws of the universe to the meta-laws of the multiverse.

The root cause of all the difficulty can be traced to the fact that both religion and science appeal to some agency outside the universe to explain its lawlike order. Dumping the problem in the lap of a pre-existing designer is no explanation at all, as it merely begs the question of who designed the designer. But appealing to a host of unseen universes and a set of unexplained meta-laws is scarcely any better.

This shared failing is no surprise, because the very notion of physical law has its origins in theology. The idea of absolute, universal, perfect, immutable laws comes straight out of monotheism, which was the dominant influence in Europe at the time science as we know it was being formulated by Isaac Newton and his contemporaries. Just as classical Christianity presents God as upholding the natural order from beyond the universe, so physicists envisage their laws as inhabiting an abstract transcendent realm of perfect mathematical relationships. Furthermore, Christians believe the world depends utterly on God for its existence, while the converse is not the case. Correspondingly, physicists declare that the universe is governed by eternal laws, but the laws remain impervious to events in the universe.

I think this entire line of reasoning is now outdated and simplistic. We will never fully explain the world by appealing to something outside it that must simply be accepted on faith, be it an unexplained God or an unexplained set of mathematical laws. Can we do better? Yes, but only by relinquishing the traditional idea of physical laws as fixed, perfect relationships. I propose instead that the laws are more like computer software: programs being run on the great cosmic computer. They emerge with the universe at the big bang and are inherent in it, not stamped on it from without like a maker's mark.

Man-made computers are limited in their performance by finite processing speed and memory. So, too, the cosmic computer is limited in power by its age and the finite speed of light. Seth Lloyd, an engineer at MIT, has calculated how many bits of information the observable universe has processed since the big bang. The answer is one followed by 122 zeros. Crucially, however, the limit was smaller in the past because the universe was younger. Just after the big bang, when the basic properties of the universe were being forged, its information capacity was so restricted that the consequences would have been profound.

Here's why. If a law is a truly exact mathematical relationship, it requires infinite information to specify it. In my opinion, however, no law can apply to a level of precision finer than all the information in the universe can express. Infinitely precise laws are an extreme idealisation with no shred of real world justification. In the first split second of cosmic existence, the laws must therefore have been seriously fuzzy. Then, as the information content of the universe climbed, the laws focused and homed in on the life-encouraging form we observe today. But the flaws in the laws left enough wiggle room for the universe to engineer its own bio-friendliness.

Thus, three centuries after Newton, symmetry is restored: the laws explain the universe even as the universe explains the laws. If there is an ultimate meaning to existence, as I believe is the case, the answer is to be found within nature, not beyond it. The universe might indeed be a fix, but if so, it has fixed itself.

· Paul Davies is director of Beyond, a research centre at Arizona State University, and author of The Goldilocks Enigma paul.davies@asu.edu