Peter Dawson, 46, who was serving in the Royal Navy at the time, was convicted of raping the girl on one occasion between May 11, 1999 and September 30, 2000 at a house in Helensburgh.
He was also found guilty at the High Court in Glasgow of sexually abusing the girl and her sister.
Dawson showed his second victim a pornographic film and sexually abused her at a house in Helensburgh on various occasions between July 1, 1998 and September 30, 2000 when she was aged between four and five.
The offences were committed while Dawson was babysitting.
He continues to protest his innocence.
Jailing him, judge Lady Wise said: "You abused these vulnerable young girls in their home which should have been their sanctuary.
"The abuse took place when the girls' mother was at work. Both girls were too young at the time to realise the extent of your wrongdoing. You perpetuated sexual abuse on these two young girls without thought to the harm it would do to them."
Lady Wise told Dawson that his offences were "cunningly planned and executed".
Defence counsel Lorraine Glancy said: "When these matters first came to light. He appeared to have made a fairly serious attempt to take his own life, but was prevented from doing so by police and work colleagues."
Miss Glancy told the court in Glasgow that after leaving the Royal Navy, Dawson, a first offender, had worked as an engineer.