It was the ultimate populist, right-wing double act. At an election rally in Jackson, Mississippi, on Wednesday night, Republican presidential candidate Donald Trump, who is pitching his campaign against the US political establishment, was joined by Nigel Farage, the former leader of the United Kingdom Independence Party, who can claim more than any other to have overturned the British political order with his role in the Brexit vote.

Farage was there to deliver a message of hope from the Brexit campaign to Trump supporters that their cause can triumph over the political elite despite what the polls say. "We reached those people who have never voted in their lives but believed they could take back control of their country, take back control of their borders, and get back their pride and self-respect," he told the crowd.

This sounds a lot like Trump's own rhetoric, but the two men share more than a nationalist worldview and a propensity to cause deliberate offence. They are also both umbilically linked to Breitbart News, the firebrand anti-establishment website of the "alternative right". On both sides of the Atlantic, leading Breitbart staff have flitted from the website to the Trump and Farage campaigns, blurring the lines between journalism and political campaigning.

Earlier this month, Trump announced that Steve Bannon, Breitbart's executive chairman and a formal naval officer, would be taking over his campaign as chief executive. While the outlet had long been Trump's most fervent cheerleader, the decision stunned the US political establishment and media.

The prototype for Breitbart's merger with the Trump campaign, however, was Farage and UKIP, a party Bannon has lauded as the British branch of a global nationalistic uprising. The ties go deep: Breitbart's UK editor-in-chief briefly quit the site to work as Farage's chief of staff, before seamlessly moving back through the revolving door into journalism when he was no longer required.

Bannon launched Breitbart's UK offshoot in early 2014. Journalists who worked there in the early days told BuzzFeed News this week that he had wanted to fill a gap he had spotted in the UK market for a news outlet with a populist, nationalist, anti-immigration agenda. Since then, Breitbart London has relentlessly trumpeted Farage and UKIP as the political wing of that cause, helping push the party platform further to the right in the process.

"Breitbart has, from conception, been broadly supportive of UKIP," Gawain Towler, the party's director of communications, told BuzzFeed News, adding that “it's always very much been a friendly online news provider.”

The relationship is far more intertwined than that suggests. And at the heart of it is Raheem Kassam. Now the editor-in-chief of Breitbart London, the 29-year-old has also served as a key aide to Farage and was alongside his old boss in Mississippi on Wednesday night.

Kassam and another right-wing journalist, James Delingpole, were Bannon's first two hires when he was launching the UK site two years ago. A veteran of fringe right-wing think tanks, including the Henry Jackson Society and the Bow Group, Kassam was once described by Bannon as "a huge piece of manpower".

But he has been a divisive figure with other senior figures in UKIP, which has long been riven with bitter factional squabbles, often played out on the Breitbart site.

"Raheem has been quite clever in the way that he's used Breitbart and its readership to push stories to further his own political agenda, as far as he wants UKIP to develop a move to be trenchantly right-wing," said Patrick O'Flynn, one of UKIP's MEPs, who has been engaged in an ongoing internal battle with the Farage wing of the party.

"There's an ongoing close relationship between the two of them, and it covers a lot of UKIP issues from a particular standpoint, of US-style attack dog politics."

Bannon was "very close" to Breitbart London when it launched, the ex-staffers said, and was instrumental in the site's push towards anti-immigration coverage.

Success in the UK wasn’t immediate, but recurring series like a migrant crisis live wire, which documented alleged crimes committed by migrants in western Europe, eventually found its audience, even in other countries such as France and Germany, according to former staffers. They said it was Kassam, then the managing editor, who was the most keen on the explicitly extreme lines.

Soon after joining Breitbart, he developed a friendship with Farage, whom he met through Matt Richardson, a UKIP official who also knew Bannon. According to reports, the relationship quickly became so close that Breitbart staffers grew frustrated by the site's doggedly pro-UKIP editorial line. "We effectively became the UKIP comms office," one disgruntled employee told The Spectator in 2015. Breitbart editors in the US would echo that complaint later when they quit over the site's coverage of Trump.

The relationship became closer still in October 2014, when it was announced that Kassam would be leaving Breitbart to formally join UKIP as one of Nigel Farage’s advisers to prepare for the general election of May 2015.

The move was controversial, as the more moderate and libertarian wing of UKIP, including its sole member of parliament, Douglas Carswell, feared that Kassam would push Farage towards a more aggressive, tea party–style rhetoric, and use his influence in Breitbart to do so.

That fear wasn't unfounded, with one senior party source saying that "Breitbart has been partisan both for UKIP externally and internally in UKIP".

The source was keen to add, however, that this wasn't always done on Farage's orders, explaining that "Raheem in his activities often would act in a way that he felt Nigel would approve of, whether he did or not."

The friction went beyond politics, with one sympathetic UKIP former staffer claiming that Kassam "got a lot of stick because people didn't like him...a lot of people didn't like his personality".

By then, Farage had also become close to Bannon himself: Following a speech he gave to the Breitbart Washington office, the UKIP leader was invited to speak at CPAC, the biggest US conservative gathering of the year, in March 2015.

Farage accepted, to the fury of some in the party because it meant he missed UKIP's spring conference, which was taking place just a few months before a general election. His speech was preceded by a glowing introduction from Breitbart's US editor-in-chief Alexander Marlow.

During the general election campaign, Farage's style also became more confrontational and openly anti-immigration, which many blamed on Kassam. One particular example was the leaders' debate in April, when Farage complained about the cost of treating immigrants with HIV on the NHS.

Other party leaders reacted with shock and disgust: Kassam, on the other hand, was in the spin room that evening, boasting to journalists that he was the one who'd come up with that line, though he has since denied being involved.

He also denied being behind Farage's changing election tactics, calling such claims a "smokescreen" deployed by senior UKIP figures who had also worked on the campaign. "I just wish a Westminster journo would bother looking into that stuff rather than believing that a 29-year-old assistant was responsible for a national political campaign!"

During that conversation on Monday, Kassam also told BuzzFeed News: “There isn’t a 'wider relationship' [between UKIP and Breitbart] so I don’t have anything to say on the matter! Can’t remember when I last spoke to a Kipper!” Two days later, he was tweeting about having exclusive access to Farage at the Trump rally.

After the 2015 general election, in which Farage failed for the seventh time to win a seat in parliament, the party fell into chaos. As the finger-pointing went on about who was to blame for the disappointing results, Kassam was led out of the party and decided to go back to Breitbart.

In his absence, James Delingpole had been left in charge, along with Milo Yiannopoulous – later to become one of the site's US stars – and according to one person involved in the site, the pair had been trying to move Breitbart away from its fiery anti-immigration, anti-Islam stance.

They both opposed Kassam's return, to the extent that political gossip blog Guido Fawkeshinted at the time that they were quitting the company.

However, Bannon, still close to Kassam, decided to back his protege. He ignored Yiannopoulos and Delingpole's pleas, and Kassam was given full editorial control and made UK editor-in-chief.

Kassam was at the time still "clearly very close to Nigel", a UKIP source said, something he then took advantage of by making Breitbart an active participant in UKIP's civil war and the run-up to the EU referendum.

Farage was even given a Breitbart column in June 2015, which he first used to talk about the referendum, but has since moved back to UKIP internal politics, with the latest published piece attacking the party's ruling committee.

"The fact is that [Kassam] was Nigel's adviser, then went back and said explicitly that he would keep a very clear sight on UKIP," the party's former head of media, Alexandra Phillips, told BuzzFeed News.

"It's a known thing, especially when you speak to young UKIP activists; Raheem and Breitbart are the best tool. In terms of internal communications it's become a great force, in terms of party infighting."

On 24 June, the day of the Brexit result and the triumphant culmination of Farage's often lonely fight to take Britain out of the EU, the UKIP leader went on Bannon's radio show and thanked the site for its coverage.

"We need a few good journalists like Breitbart," Farage said, before thanking Breitbart "on both sides of the pond". Bannon replied by telling Farage: "Your UKIP team is just incredible!"

The following month, Bannon was claiming credit again, telling the Huffington Post: "We were the first guys in back of UKIP." He also hinted that the office had been opened in the UK because "we knew the Brexit thing was going to be big one day".

When Farage resigned as leader shortly after the vote, Kassam said that he was considering making the jump back into politics once more, floating the idea that he himself should run to be UKIP leader. His aim was to stop more moderate candidates pushing the party back towards the more traditional right wing.

Kassam decided not to run in the end, but he has since written multiple news stories and opinion columns on Breitbart about the ongoing and bloody leadership contest.

Asked if he thought that the website would try to influence the contest, Patrick O'Flynn told BuzzFeed News: "I think Breitbart will try to, but it only speaks to a certain segment of UKIP party members, and that's not the majority of them; it's only fair to observe that a high proportion of our party members who are older aren't particularly into social media and online news."

But as Wednesday night's joint appearance by Trump and Farage shows, Breitbart's influence continues to grow. And it is happy to blur the line between reporting on the new right-wing political movement – and playing an active part in it.

Marie Le Conte is a politics and media reporter for BuzzFeed News and is based in London.