The home secretary, Sajid Javid, has singled out Nigel Farage and the Brexit party for praise in a speech in London, saying: “They are not extremists.”

In an incongruous moment in a speech about countering extremism, Javid said “credit” was due to Farage for walking away from his former party, Ukip, as it lurched to the far right. The move will be seen by some as an effort by the Tory party to extend an olive branch to the Brexit party.

Javid’s comments come amid increased speculation about the role Farage and the Brexit party might play alongside a Boris Johnson-led Conservative party. The possibility of a future Tory-Brexit party coalition has been speculated upon, along with various roles for Farage such as a trade envoy to the US.

“And we must give credit where credit is due. So I applaud Nigel Farage for walking away, calling Ukip ‘thugs and extremists’,” Javid said. “Even though his Brexit party has not made my life any easier, I want to be clear – they are not extremists.

“Because it doesn’t help to exaggerate the problem, to demonise anyone with a different view and to see danger when it is not there.”

Under the leadership of Gerard Batten, who quit last month, Ukip became a hardened far-right party, employing the extremist Stephen Yaxley-Lennon, also known as Tommy Robinson, as an adviser on grooming gangs. Farage denounced the party’s shift and his newly formed Brexit party took several seats in the European parliament in May.

Facebook Twitter Pinterest Nigel Farage in Strasbourg, France. Photograph: Roberto Monaldo/Rex/Shutterstock

But Farage too has been criticised in the past for encouraging extremism with anti-immigrant rhetoric, including the notorious “Breaking Point” poster used in the EU referendum campaign. He has also said he would ban migrants with HIV from entering the UK, would feel uncomfortable if Romanians moved in next door, did not feel comfortable when people spoke a different language on the train and described parts of the UK as a “foreign land”.

Farage warmly welcomed Javid’s comments, tweeting: “So there is some decency left in politics.”

Nigel Farage (@Nigel_Farage) So there is some decency left in politics. https://t.co/AOjBuxOf5w

Elsewhere in the speech, Javid said he would block some businesses and organisations from sponsoring migrant workers, starting with the activist group Cage, as part of a broader plan to combat extremism. He said groups that did not adhere to British values would be targeted. He singled out Cage and Mend as two organisations that attempt to sow division by portraying the government as anti-Muslim.

Cage describes itself as a campaigning charity that works with people affected by the war on terror. It rose to notoriety in 2015 when it emerged the group had been in contact with Mohammed Emwazi, the British Isis killer known as Jihadi John, before he fled to Syria. The group described him as a “beautiful” person.

Javid spoke alongside Sara Khan, who heads up the commission for countering extremism (CCE), which Cage has criticised in the past.

A Cage spokesperson said: “By diverting public attention away from the abject failure of the CCE, Javid chose to praise the bigoted Nigel Farage and demonstrated he cannot understand, nor tolerate, the long-standing tradition of dissent that has shaped Britain.”

Javid also urged public figures to moderate their language as part of the fight against extremism, saying that he “knows what it’s like to be told to go back to where I came from”.

His comments appear to be a retort aimed at Donald Trump, after the US president told four congresswomen of colour, all of whom are US citizens, to “go back home” to other countries.

But the speech also comes at a time when Johnson faces renewed scrutiny for controversial remarks in the past, as he runs to be the leader of the Conservative party and the UK’s next prime minister.

Johnson has been accused of stoking division and extremist views by suggesting last year that Muslim women wearing a burqa looked like letterboxes or bank robbers.

His choice of language has frequently been challenged, including when he referred to the former US president Barack Obama as “part-Kenyan”, when he wrote a poem in the same year about the Turkish president having sex with a goat, and when he referred in 2002 to Commonwealth residents as “flag-waving piccaninnies”.

It emerged this week that he once argued in an essay that Islam had caused the Muslim world to be “literally centuries behind” the west.

Javid, the son of a Pakistani immigrant and of Muslim heritage, who has publicly backed Johnson for the next leader, said everybody had a part to play to stop extremists spreading poisonous narratives.