A sheriff from Aberdeen befriended Angelika Kluk during visits to the Glasgow church where her body was discovered, a court has heard.
The sheriff said he had taught Angelika Kluk to play golf
Kieran McLernan told the High Court in Edinburgh that he had introduced Miss Kluk to golf and taken her to a driving range on the weekend she probably died.
Sheriff McLernan, 65, said he had hugged the Polish student and given her a present on the night before she died.
Peter Tobin, 60, denies raping and murdering Miss Kluk last September.
Sheriff McLernan said he met Miss Kluk after he started attending St Patrick's Church in Glasgow, with his wife and found the Polish student to be "very lively and bright."
He described how he and Miss Kluk had travelled to Bishopbriggs in the sheriff's car to visit a driving range shortly before she disappeared.
When they returned to St Patrick's, Miss Kluk gave the sheriff her e-mail address on a yellow post-it note.
The sheriff said: "Then it was 'I'm off'. So at that point she gave me a hug, a short hug."
Sheriff McLernan said he had recently returned from a trip to Canada and gave Miss Kluk a dream catcher he had bought as a souvenir.
He added: "She was touched by the story, I think. Keep the bad dreams away and only allow the good dreams to come in."
Earlier, the court heard that a weapon which may have been used to attack Angelika contained no DNA from Mr Tobin.
A blood-stained table leg was found against an outside wall of the church and a bloody knife was found in a bag dumped on top of Angelika's body, under the floor of the church.
Under cross examination from Donald Findlay QC, defending Mr Tobin, forensic scientist Carol Weston said: "I don't believe we found Mr Tobin's DNA on the knife. We only found Angelika Kluk's DNA on the table leg."
Fellow forensic scientist Martin Fairley, 45, who has 24 years experience, told the court he had found DNA matching Mr Tobin on a gag that had been wound tightly round Angelika's head.
Advocate depute Dorothy Bain, prosecuting, asked: "Is it a reasonable conclusion to make that he (Mr Tobin) touched the tape.
"I think it is a reasonable conclusion," Mr Fairley replied.
Carol Weston said that the weapon contained no DNA from Mr Tobin
Miss Kluk had been staying at the chapel house attached to St Patrick's Church in the Anderston area of the city, and working as a cleaner to help finance her language studies in Gdansk.
Mr Tobin is accused of attacking Angelika between 24 and 29 September in St Patrick's Church, or elsewhere, gagging her with cloth and tape, binding her hands with cable ties, raping her, smashing her skull with a piece of wood or something similar, stabbing her 16 times in the chest and inflicting other knife injuries.
It is alleged that he then hid the body under the floor of the church.
A further charge alleges that he told Glasgow police his name was Patrick McLaughlin, gave a false date of birth and address, and that he travelled to London and gave staff at the National Neurology and Neurosurgery Hospital in Queen's Square, London, another false name.
Mr Tobin also denies a breach of the peace between July and September last year by threatening Russian student Rebecca Dordi at St Patrick's Church.
The trial continues.