The check-in staff want to know if you have a bomb in your bag. But you're more worried that your partner might have been cheating on you.

What you both need is a mind-reading machine, a way of peering into their heads and "seeing" their thoughts before they are articulated. Not only does that machine now exist, it is being touted for airports, police stations and even workplaces.

Don't even think about lying. The "brainbox" in question is officially known as a functional magnetic resonance imaging (fMRI) detector, a medical device which companies in the US are now marketing as a lie detector, claiming accuracy of 90% to 100%.

No wonder, then, that law-enforcement agencies, including the FBI, CIA and the US Defence Department, are pumping big bucks into what they hope will be the successor to the polygraph.

While the polygraph measures the stress that telling a lie causes, the MRI-based devices purport to measure the lie itself. Sections of the brain light up on the scanner the moment a lie is formed in the mind.

It sounds like science-fiction, but the machine is already working its way into the justice system. Earlier this year, a Scottish woman who claims she was wrongly convicted of child abuse used the machine in an attempt to prove her innocence.

Susan Hamilton, of Broomhouse, Edinburgh, served three years in prison after allegedly giving an eight-year-old girl potentially lethal doses of salt. Mrs Hamilton, 43, was acquitted of attempted murder, but found guilty of assault to the endangerment of life. She has always denied being responsible for the high levels of sodium in the child's bloodstream. As part of a campaign to clear her name, she took part in an fMRI lie-detector test as part of the Channel 4 documentary Lie Lab earlier this year.

The result was remarkable. The scan was consistent with someone who is telling the truth. "Although this research doesn't prove that this woman is innocent, the scan clearly demonstrates that her brain responds as if she were innocent," says Professor Sean Spence, of Sheffield University, who leads UK research into fMRI and lie detection.

"This research provides a fresh opportunity for the British legal system as it has the potential to reduce the number of miscarriages of justice."

Mrs Hamilton's legal team is already planning an appeal. It remains to be seen whether a court will consider the fMRI results. But if they did, it would set a fascinating legal precedent. Spence is not the only one who believes in the power of fMRI. In the US, two companies are already competing to market lie-detection services.

But does the science support their claims? Are they being truthful when they say their machine can spot a liar? fMRI works by measuring blood-oxygen levels in the brain. Your brain is made up of lots of different areas, which do different jobs such as generating language and retrieving memories.

There is no one part of the brain which acts as a dedicated "lying centre". But more than a dozen studies, by Spence and others, have suggested that forming a lie produces a milliseconds-long burst of bloodstream activity in the prefrontal cortex, the part of the brain associated with decision-making.

Thus, in theory, to detect a lie, all one need do is to establish a baseline reading for truthful activity - by asking a subject for statements which are known to be true and then begin interrogating while watching for any deviations which might indicate a lie. Despite the reports of 90% and even 100% accuracy, many scientists doubt that those results will prove replicable outside the lab setting. Spence believes fMRI evidence should be allowed in courts, but only once enough clinical trial work has been done to pin down the statistical accuracy of the tests.

"I don't think there's any doubt it will be better than the polygraph. Given that we have only been working on this for six years, I think it's amazing that we can see areas of the brain that light up lying. That's only going to get more refined as time goes by."

Of course, the drawback of MRI is the sheer bulk of the scanner, not to mention the time delay in analysing scan results. What the security agencies really want is something portable and instantaneous - a pair of X-ray specs, perhaps. Incredibly, this is not so far-fetched. We are already halfway there, thanks to an invention by Professor Britton Chance, of Pennsylvania University.

His "cognoscope" uses near-infrared light sensors mounted on a Velcro headband. Standing next to a subject, Professor Chance is able to measure blood and oxygen flow in the brain just beneath skin.

"What he's looking for is a little blip just behind the forehead that indicates a lie," Spence explains.

After 9/11, the Defence Department became interested in Chance's work. In a test on soldier volunteers, the device correctly picked the liars, though it also recorded a false positive.

"It sounds laughable at first, but it's certainly scientifically possible," says Spence. "What's not funny is that this is taken very seriously in America. This is the technique they are thinking of applying at airports. And, of course, you don't necessarily have to be aware that you are being scanned. You could be asked, Did you pack your bag?' "He's aiming for these to be rolled out at airports and that, I think, is quite worrying."