Former FBI director James Comey was apparently unsettled by Donald Trump's unwanted attention and concerned about contacts made to him by the president's aides.

Before Comey shook Trump's hand in the White House's Blue Room in footage that has been played often since his ousting, the senior intelligence officer had tried to blend in with the curtains to escape Trump's "inappropriate" behaviour.

Benjamin Wittes, a friend of Comey's and a senior fellow at the Brookings Institution told reporters about a lunch he had with Comey in March.

During it, Comey described his attempts to keep a distance between the FBI and the White House during the first two months of Trump's administration.

"He had to throw some brushback pitches to the administration," Wittes said, according to The New York Times.

Among those interactions was a dinner in which Trump reportedly asked Comey to pledge his loyalty and a meeting in which Trump asked Comey to shut down an investigation into his former national security adviser, Michael Flynn.

Comey detailed all his interactions with Trump and his staff in memos he wrote at the time and gave to his aides, the Times reported.

Wittes added that Comey was uncomfortable with the president's attempts to build a personal relationship, which he considered to be inappropriate. Comey reportedly described a couple of encounters with Trump that had concerned him.

James Comey
Director of the FBI James Comey walks to greet Donald Trump during the Inaugural Law Enforcement Officers and First Responders Reception in the Blue Room of the White House on 22 January 2017 REUTERS/Joshua Roberts

Trump hosted a ceremony honouring law enforcement officials two days after the inauguration. Comey did not initially want to attend but went to represent the bureau. During the ceremony in the Blue Room, the 6ft 8in tall FBI director tried to blend in with the blue curtains at the back of the room to avoid Trump calling on him.

"He thought he had gotten through and not been noticed or singled out and that he was going to get away without an individual interaction," Wittes said Comey told him. Unfortunately for Comey, Trump spotted him and called out to him.

"Oh and there's Jim," Trump said. "He's become more famous than me."

Comey walked up to Trump and preemptively reached out for a handshake to avoid a hug, Wittes said. "But Trump pulled him into an embrace and Comey didn't reciprocate. If you look at the video, it's one person shaking hands and another hugging," he added.

Despite his various attempts to bring Comey into the fold, Trump continued to receive resistance. On 9 May, Trump sacked Comey in what would become the beginning of controversy-filled week for the president.