The Supreme Court has unanimously declared unconstitutional the law under which any man is automatically guilty of a crime if he has sex with a girl under 15.

The court made its decision on several grounds, including the failure to allow the defence that a genuine mistake had been made about a girl's age.

The successful challenge to the legislation was brought by a 23-year-old man.

He had admitted having consensual intercourse with a girl who, he claimed, had told him she was 16. He was 17 at the time in 2001.

Until today if a man or boy was convicted of having sexual intercourse with a girl under 15, even if it was consensual, he could face up to life imprisonment under the 1935 legislation and he would also be placed on the Sex Offenders Register.

But the Supreme Court has shot down the relevant provision of the Act, which did not allow any defence to be offered where the fact of sexual intercourse was admitted or established.

The challenge to the Act was brought by a young man who was facing four charges of the statutory rape of a 15-year-old girl.

He admitted having sex with the girl, but claimed she had told him she was 16.

His senior counsel, Deirdre Murphy, pointed out that the law as it stood left men like her client without a reasonable defence even when positiviely convinced by the girl herself that she was over the statutory age.

She argued that that it was inconsistent with the right to a fair trial to deny her client the defence of mistake or mistake on reasonable grounds.

The Supreme Court agreed that the section offered absolutely no defence once the act of sexual intercourse was established.

Mr Justice Hardiman said that once a man has sex with a girl whom he honestly believes to be over the relevant age, a mentally innocent person is criminalised.

To criminalise in such a serious way a person who is mentally innocent inflicts a grave injury on that person's dignity and sense of worth, he said.

He said the right of an accused not to be convicted of a true criminal offence in the absence of intent was done away with by this Act.

But the court said today's decision does not prevent the Oireachtas from enacting different legitimate laws to discourage sex with very young girls.