A ten-year-old boy was lured from an amusement arcade and taken to a remote copse in the Sussex countryside where he was sexually abused, a jury heard.
Anthony Valentine, 46, is accused of tricking the youngster into going with him by buying him presents and toys.
Lewes Crown Court heard yesterday he also told the youngster he was armed and was a former bank robber.
Philip Katz, prosecuting, told the jury Valentine befriended the boy while he was playing at an arcade on Bognor Regis seafront one afternoon last summer.
Mr Katz said unemployed Valentine kidnapped the child on July 11 and kept him until the early hours of the next morning.
During the boy's ordeal, he was taken on a train journey from Bognor to Barnham and then on a walk of up to four miles through the countryside until they reached a secluded copse by a stream, near Lidsey, where the boy was sexually assaulted.
The boy was finally found by police at about 3am when a taxi driver, who was aware a boy was missing, spotted Valentine with the child and alerted the police.
Mr Katz said: "This defendant tricked a young boy into going with him.
"He took him shopping, bought him gifts, kept him entertained and took him on a train journey.
"There can be no question that this defendant had it in mind from the word go to have sex with this young boy."
Mr Katz said the boy told police that Valentine warned him he had a knife, although the boy never saw a weapon.
Valentine, of Boltro Road, Haywards Heath, is accused of kidnap, two offences of child abduction, two offences of indecent assault plus an offence of indecency with a child.
He denies all charges.
The trial continues.
Comments: Our rules
We want our comments to be a lively and valuable part of our community - a place where readers can debate and engage with the most important local issues. The ability to comment on our stories is a privilege, not a right, however, and that privilege may be withdrawn if it is abused or misused.
Please report any comments that break our rules.
Read the rules hereComments are closed on this article