The last ever photo of the police officer who was killed in the Westminster terror attack appears to have been taken just 45 minutes before he died.

US tourist Staci Martin posed in the picture next to PC Keith Palmer in front of the Houses of Parliament shortly before he was stabbed to death by Khalid Masood.

He was one of four people killed after Masood ploughed a car into pedestrians on Westminster Bridge before ramming the vehicle into the gates of Parliament.

After PC Palmer ran to the scene, he was fatally wounded before one of his colleagues shot Masood dead.

“It’s my first time in London and I saw his hat and I’m like, I have to take a picture of him with his hat,” Ms Martin told ABC News. “I walked up to him and said ‘do you mind if I take a picture?’ He said ‘no problem’, he was really nice.”

Australian tourist Andrew Thorogood also shared a picture of his encounter with the officer.

Mr Thorogood described how Mr Palmer had been happy to pose for a photo with his family during their trip to London last October.

“It sent a shiver down my spine when I realised Keith was the officer who was killed in the London terror attack which took place last [on Wednesday] night,” he wrote on Facebook.

“I spoke with Keith for quite a while and found him to be a genuinely nice bloke. He said he would love to visit Australia with his family one day. The girls suggested if he did make it to Australia, he should visit Alice Springs and we would show him how special a place it is.”

Mr Palmer’s family paid tribute to “a wonderful dad and husband” as the Metropolitan Police said it would not reissue his shoulder number.

Describing him as “a loving son, brother and uncle” and “a long-time supporter of Charlton FC”, they said he was “dedicated to his job and proud to be a police officer, brave and courageous”.

They added that he was “a friend to everyone who knew him”.

“He will be deeply missed,” they said. “We love him so much.”

Members of the public have donated more than £100,000 after the Metropolitan Police Federation launched a memorial fund to pay tribute to its fallen colleague. It said he was “simply doing his job” when he was stabbed to death.

PC Palmer, who was father to a five-year-old daughter, had joined the parliamentary and diplomatic protection command less than a year ago.

Scotland Yard said it would retire his shoulder identification number.

It tweeted: “As a mark of respect Keith’s shoulder number – 4157U – will be retired and not reissued to any other officer.”

House of Commons deputy speaker Lindsay Hoyle said Westminster had lost “one of our village policemen”.