TORONTO -- A Pakistani man accused of plotting terror attacks on Toronto's financial district and the U.S. consulate espoused extremist views and repeatedly expressed sympathy for al Qaeda and the Islamic State, an undercover RCMP officer testified Tuesday.

In fact, the officer said, Jahanzeb Malik told him his own family had rejected him because of his beliefs.

"He said it several times: that believers are ready to die for Islam," the officer said.

"He said his family had disowned him, that his brother called him a terrorist."

The agent, who cannot be identified under an extensive publication ban, described posing as a Bosnian war veteran. He said he contacted Malik in September 2014 about renovating the flooring of his house.

Malik, a flooring contractor, quickly came to trust the officer. In conversations, he told the officer he had received training in weapons and explosives during two years he spent in Libya before returning to Canada in 2013, the officer testified.

"He said he went to Libya to kill or be killed," the officer said.

Earlier in the day, Malik, 34, had testified spending only two months in Libya -- in Benghazi -- two years ago. He said he had gone there to teach English as a second language.

"It was a job opportunity," he said. "I went there, you know, to make some money."

The federal government, which also accuses Malik of trying to recruit and radicalize others to help commit terrorist acts, wants to deport him.

The case before the Immigration and Refugee Board is largely based on evidence gathered by the undercover RCMP officer, who said Malik came to call him his "student."

Malik, who fidgeted and yawned during the testimony, showed him Islamic State videos of executions and declared that the dead bodies of true Muslim believers smelled better than those of non-believers, the agent said.

Malik also told the officer he had divorced his wife in Canada and had married a woman in Libya, a place he said he loved and wanted to live in, the board heard.

The officer's testimony came after Malik abruptly decided he would no longer testify -- despite facing a fine of up to $100,000 and/or a maximum sentence of five years in prison for the refusal.

"I'm choosing not to answer the questions -- any questions," Malik told Andrew Laut, the board member presiding over the hearing.

His change of heart came after he had already answered several questions from John Oliveira of the Canada Border Services Agency.

Oliveira asked him about his religious beliefs and to which Muslim sect he belonged to.

"I don't believe in sects. I'm a simple Muslim," Malik said via video link from the detention centre in Lindsay, Ont. "I'm not a religious scholar."

Was he an observant Muslim?

"I don't know what you mean," Malik said. "What's the definition of an observant Muslim?"

Malik, a father of two, came to Canada as a student in 2004 to study math at York University, and became a permanent resident in 2009.

He was vague about his various Twitter handles and multiple Facebook accounts, which he said had been hacked or disabled for reasons he didn't know. "Ask Facebook," he said.

Asked to explain one tweet in which he used an expletive against Shia Muslims, he said he wanted to make clear he didn't condone killings in the name of sects.

Malik's lawyer, Anser Farooq, noted the rules of evidence at an immigration hearing are much looser than those in a criminal court. He objected to the government's entering 400 pages of typed notes of the officer's interactions with Malik.

"We can't meaningfully test any of them," Farooq said. "(Mr. Malik) is in a forum where his hands are tied, both literally and figuratively."

The agent continues his testimony May 20.