It was a busy Friday evening in March 2015 when Uber driver James Farrar picked up three women from Canary Wharf in London Docklands. They were drunk, putting their feet up on the headrests and demanding he turn on some music. It was, for Farrar, like any other Friday night as an Uber driver. And it still was when he stopped at a set of traffic lights in nearby Aldgate only for one of the passengers to open the back door of his car and vomit on to the road.

"I said, 'Look, you need to go for a walk, get a bottle of water, and set off again when you're okay,'" Farrar recalls. The women eventually obliged. But, as he sat in his car filing a report about the incident to Uber, he spotted the women walking towards a Prius gliding into position on the other side of the road. "I thought I had a duty to warn him, as a fellow Uber driver, that this was not going to be great," he says. Farrar stepped out of his car and walked over. One of the women started shouting and pushed him. "The other two women made it as far as the middle island and collapsed in a heap," Farrar recalls. The woman shouting at Farrar then called him an "Irish cunt".

Farrar, concerned Uber wouldn't believe his version of events, held up his phone to take a picture of the collapsed women. Enraged, one of them called Farrar a pervert. "This big guy, a construction worker, jumps out of his car, fists out, because he assumed the worst, right?" Farrar says. "He assumed I had done something, and she was calling me a pervert, and I was in the wrong. I got away from the situation. The women followed me back to the car, kicked the panel work, then went off."

Farrar called the police, worried that the woman who had shouted at him might take action against him, and was asked to provide further details. By now it was 3am. "The police said to me, 'What's the name of the passenger?' I said, 'I don't know.' And they were like, 'Well, surely you know? It's your customer.' I said, 'Yes, it is my customer, but I don't know the name, or the address, but I'll ask Uber for it.'" Farrar got back in his car and completed a few more rides before going home.

The next day, Uber replied via email. "Sorry to hear about this, however, we cannot provide you with that information for data privacy reasons." Farrar asked if Uber would give the details to the police. "The police will have to ask us for it," the representative replied. The police duly put in a request for the details. Uber's response was that investigators would have to obtain a court order to access the records.

In July 2015, Farrar contacted Leigh Day, a London-based law firm known for taking on corporate giants. "I said, 'Look, where's the duty of care? Where does the responsibility lie? What can we do, because this doesn't feel right?'" Leigh Day took a look at his contract. The document made it clear that Farrar was self-employed, but the realities of how he was required to work for Uber meant he couldn't be. According to UK law, he should have been classified as a worker and thus entitled to basic employment rights such as holiday and sick pay and the minimum wage.

Uber eventually sent the lead passenger's details, weeks after the request. She agreed that the statement Farrar had given to the police was correct and said she wouldn't pursue any action. "Job done, as far as I'm concerned, right?" he says. Wrong. Leigh Day was confident Farrar had a strong case against Uber over its insistence that he was self-employed. Farrar asked Leigh Day to pursue the case, setting in motion a legal battle that could fundamentally change not only Uber, but the entire gig economy.

"At the beginning, Uber was almost like a loveable rogue. But then when it turns, and they start breaking the rules, it actually hurts people," says Annie Powell, a solicitor at Leigh Day who worked on the landmark employment tribunal case against Uber

Andrew Woffinden

Solicitor Annie Powell had been working at Leigh Day for two weeks when James Farrar's Uber enquiry landed on her desk. Powell, now 32, knew little about Uber at the time. Her colleague Nigel Mackay, who worked with her on the firm's employment law team, was the first to take the view that Uber's contract wasn't worth the paper it was printed on. It was clear to Mackay that Uber's drivers, all of whom are self-employed, were being unlawfully denied employment rights and benefits. He asked Powell to call Farrar and get started on the case.

For Powell and Leigh Day, it was the perfect lawsuit. The firm, established in 1987, has a reputation for taking on multinationals and winning. One of its most notable successes was obtaining £19.9 million in compensation from the UK government for its involvement in the torture and arbitrary killing of detainees during the Mau Mau uprising in Kenya in the 1950s. The firm, which operates from scruffy offices in London's Clerkenwell area, is currently working on group claims against Asda and Sainsbury's - the former involving 17,000 female workers who are seeking equal pay for jobs of equal worth to those carried out by men. Leigh Day has also challenged BP, Shell, Unilever and mining firm Anglo American. To date, it has won more than £150 million in compensation.

It's an approach that doesn't come without controversy. In June 2017, a disciplinary tribunal cleared Leigh Day of allegations of professional misconduct during a case against the Ministry of Defence relating to the Iraq War, after it was claimed the firm's team had mishandled legal documents. The three-year case, which is thought to have cost the Solicitors Regulation Authority around £10 million, was initiated by the then defence secretary Michael Fallon. In 2014, Leigh Day partner Alison Millar said the firm's modus operandi was "to be David fighting against the Goliaths". The firm's founder, Martyn Day, proudly describes himself as a "bolshie bastard".

Powell saw the Uber case as another David versus Goliath battle. "At the beginning, Uber was almost like a loveable rogue," she says. "People like that, the little guy who takes on the taxi cartels, but then when it turns, and they start exploiting people and they start breaking the rules on a much wider scale, that actually starts to hurt people." In Farrar's contract, Uber claimed he was self-employed. What's more, it appeared to claim that every Uber driver was running their own taxi business and Uber, a technology platform, was merely connecting them with customers. Farrar succinctly describes Uber's argument as "bullshit".

Leigh Day is currently pursuing similar employment-rights cases against Deliveroo and recently secured an out-of-court settlement from UK Express Delivery, a logistics firm that delivers on behalf of Amazon. And it isn't alone. Courts in the UK are currently processing a raft of significant and related cases against gig-economy companies, from big names like Uber to lesser-knowns such as CitySprint, UK Express Delivery and Pimlico Plumbers. At the centre of all these cases is a simple question: are the people working for these companies self-employed, or are they workers or employees and thus entitled to the minimum wage, and holiday and sick pay?

Powell studied history at St John's College, Cambridge. On graduating from university, she joined city law firm Travers Smith to complete a law conversion. "I trained at a firm that will defend the Ubers, the Deliveroos," she says. "I hated it. I disliked it so much that I left law for a couple of years."

After becoming disillusioned with working in corporate law, she had a brief stint on Labour's shadow treasury team before spending 18 months working as an advisor at Waterloo Action Centre, a community charity that offers free legal advice. "It was a real eye-opener," she says. Powell's first case involved a man who had been HIV-positive since the 1980s. Powell looked over the man's Work Capability Assessment. "We had a letter from his consultant saying, 'If this man works, he will die.' His hearing was a week later, and the decision was overturned. But that's just one person." It was an experience that further strengthened her passion for social justice. In 2015, Powell joined Leigh Day's employment and discrimination team and soon realised she would be able to have an impact on a greater scale.

In Farrar's evidence against Uber, he said that in some months he earned as little as £5 per hour

Andrew Woffinden

In July 2016, the Central London Employment Tribunal began hearing Leigh Day's case against Uber and focused on the testimony of Farrar and Yaseen Aslam, another former driver who, alongside Farrar, has led the campaign to secure workers' rights. It was the first time Uber had faced legal action in the UK over the employment status of its drivers. In his evidence, Farrar said that in some months he earned as little as £5 per hour, well below the current national minimum wage for over-25s of £7.20. (It's now £7.83.) To this day, Uber continues to dispute that figure and claims that, even after accounting for running costs and Uber's service charge, the average driver in the UK earns £12 per hour.

Subsequent and related employment-tribunal rulings against gig-economy firms have undermined Uber's defence. In a July 2017 case against private-hire firm Addison Lee, an employment tribunal found that drivers - who were incorrectly classified as self-employed - were regularly required to work 50 or 60 hours a week. Crucially, the tribunal also found that the average Addison Lee driver likely needed to work between 25 and 30 hours a week to cover their costs and break even. In short: to make a living, many gig-economy workers need to put in excruciatingly long hours.

Those numbers are also reflected in official figures. In February, a government report found that a quarter of people working in the UK's gig economy - an estimated 700,000 people - earned below the minimum wage. The same report found that 42 per cent of people in the gig economy worked for courier firms, 37 per cent for apps such as TaskRabbit, 28 per cent for minicab firms such as Uber and 21 per cent for takeaway delivery services such as Deliveroo. Uber's own data reveals that nearly a third of its 50,000 UK drivers are logged into the app for more than 40 hours a week.

At the tribunal, Farrar presented evidence about how Uber sought to control the way he worked. In May 2016, when Farrar was still driving for Uber, he received a lengthy email explaining that while he was "an independent contractor", it had been noted he was logged into the Uber app while away from his vehicle. "From today, in order to ensure the Uber system runs smoothly, if you do not confirm two allocated bookings in a row we will take this as an indication you are unavailable, and we will log you off the system for ten minutes," the email read. The company later sent him a text message. "You recently missed requests that came in during other rides," it read. "Next time, accept the request." Farrar had found himself in what Uber calls the "penalty box".

Each week while he was an Uber driver, Farrar would receive an automated report on his performance. For the week April 20 to 27, 2015, he completed 29 trips and received 26 five-star ratings from passengers. "Unfortunately, your driver rating last week was below average," Uber's report cautioned. According to court documents, a number of other drivers were dismayed to find that, despite having ratings of 4.5 stars or higher, they were still deemed by the system to be "below average".

To monitor driver performance over time, Uber has created a series of checkpoints that tally the number of trips completed against an average rating during that time. Disciplinary action is taken if a driver is below a certain level at certain checkpoints. To help ensure drivers maintain high ratings, Uber may ask them to complete an "online quality session" or attend an in-person training session. Drivers are also sent links to videos from what Uber refers to as "top rated partners" which offer advice as to how to always get five stars. "What it means to be an Uber partner" reads the title of one; "Keeping your car clean and tidy" reads another.

The exact metrics by which Uber rates its drivers have never been publicly disclosed. For Uber, and its passengers, it is these secret metrics which make the service reliable. For drivers trying to make a living, it means working under the unrelenting glare of an algorithm. "I needed to keep my rating high to keep my job," fellow claimant Yaseen Aslam wrote in his witness statement. "I was always nervous of getting very low ratings from customers as it wouldn't take that many one-star ratings to put me at risk of deactivation. I felt that this system was inhumane."

Independent Workers Union of Great Britain (IWGB) members at a branch meeting. The little-known union has found itself at the centre of one of the world's most high-profile lawsuits against the gig economy

Andrew Woffinden

The tribunal also heard how, in February 2015, Aslam tried to log in to Uber only to find his account was deactivated. At the time, Uber emailed him, saying it would only reactivate his account once Aslam came to the firm's London offices to "discuss some matters". According to Aslam's account, when he did, Will Almond, Uber's senior operating lead in the city, said his account had been temporarily locked because of critical comments he had made about the firm on Twitter. "Almond warned me that I needed to be more careful in what I said on Twitter and that Uber would be monitoring me carefully going forward." Aslam explained in his witness statement. When asked to comment on this, Uber said that Aslam had his account put on hold for uploading fraudulent documents - and encouraging others to do so.

In meetings with Uber following the "Irish cunt" incident, Farrar became concerned about the company's conduct. He paints a picture of a paranoid corporate culture that often resulted in staff behaving defensively when challenged or questioned. "It's like they go on the attack, you know?" he says. At a June 2015 meeting with Alex Cappy, then director of driver operations for Uber in the UK, Farrar was asked to turn his phone off and on to prove he wasn't recording what was being said.

In the tribunal, Uber's counter to the evidence presented by Leigh Day was that it was a technology firm, not a transportation business, and that its drivers were independent, self-employed contractors who could work whenever or wherever they liked. Leigh Day argued that Uber's contract with its drivers, and the realities of day-to-day life as an Uber driver, made this agreement unlawful. After six days of evidence, the tribunal came to a close. In October 2016, it delivered its verdict: Uber drivers were not self-employed and should be entitled to workers' rights. In a landmark ruling, the judges were scathing of Uber's defence. "It is not real to regard Uber as working 'for' the drivers. The only sensible interpretation is that the relationship is the other way around," they concluded. The judges also accused Uber of "resorting in its documentation to fictions, twisted language and even brand new terminology" and dismissed Uber's argument that it was "a mosaic of 30,000 small businesses linked by a common 'platform'" as "faintly ridiculous". Uber has since conceded that it is, in fact, a transportation business but maintains that its drivers, all of whom are still self-employed, should be entitled to no additional employment rights.

Immediately after the tribunal, Uber announced it would appeal. A little over a year later, in November 2017, Uber lost that appeal. During the hearing, Uber's counterargument rested heavily on the dismissal in 2012 of a case brought against "gentleman's club" Stringfellows by a former lap dancer.

This happened in December 2008, when Nadine Quashie was dismissed from her job at Stringfellows in London. At times she would take home more than £1,000 from dancing - but customers didn't pay Quashie in real money. Instead she received prepaid "heavenly money" - a sort of voucher scheme invented by the club's owners. At a tribunal, Quashie argued that restrictions imposed upon her by the club, including her payment in vouchers which were then converted into cash, meant she couldn't possibly be self-employed and thus had been unfairly dismissed. The judge ruled this was not the case, stating that Quashie's dancing was ancillary to the main purpose of Stringfellows, which was viewed as a restaurant. Quashie and other dancers, the tribunal ruled, were provided with a marketplace to sell their services. Uber claimed the same, albeit in this case the marketplace was taxis, not lap dancers. But Uber's argument has proven unpersuasive. For one, the dancers at Stringfellows were able to negotiate a fee with customers. Secondly, it was possible to argue from a legal standpoint that Stringfellows really was a restaurant. But Uber drivers cannot negotiate a fee, nor can Uber claim its primary purpose is not a transportation company.

Despite losing for a second time, Uber appealed again. The case is currently awaiting a date at the Court of Appeal and is unlikely to be heard before the end of 2018. In May 2018, Uber said it would provide drivers with limited insurance against sickness and injury as well as nominal maternity and paternity payments. In a statement issued at the time, Uber said the change of policy would give drivers "peace of mind while preserving the flexibility they value". But Farrar accused Uber of "tinkering around the edges" and says that if it really cared about its drivers, it would stop fighting them in the courts. Deliveroo also recently announced a similar rider insurance scheme. If and when Farrar and Aslam's case reaches the Supreme Court, defeat for Uber could set a legal precedent for a raft of related gig-economy cases.

IWGB general secretary Jason Moyer-Lee: "The UK, as far as I can tell, has virtually no government enforcement of employment law"

Andrew Woffinden

Jason Moyer-Lee sits in a cramped office on the first floor of a nondescript building near Angel Underground station in north London. There are stains on the walls and photos of protests he's attended are dotted about the room. "What Uber is selling is not access to its app," he says. "It's selling a mechanism to get the customer from point A to point B. When the customer uses Uber, they have a legitimate expectation of how much it's going to cost and what they can expect. It's like McDonald's: you have an expectation of what a Quarter Pounder is going to taste like, right?"

Originally from Maine in the US, Moyer-Lee, 32, is the outspoken general secretary of the Independent Workers' Union of Great Britain (IWGB). Founded by a group of Hispanic cleaners as a breakaway from Unite and Unison in August 2012, the little-known union somewhat improbably finds itself at the centre of the gig-economy legal showdown. Shortly before the November 2017 appeal hearing of James Farrar and Yaseen Aslam's test case against Uber, the pair left the GMB union (which also represents black-cab drivers and private-hire operators, something Moyer-Lee describes as "a conflict of interest") to join the IWGB. Farrar is chair of its United Private Hire Drivers branch. For a union that was until recently headquartered in a basement beneath a dry cleaners, involvement in the lawsuit was a major coup.

"The UK, as far as I can tell, has virtually no government enforcement of employment law," Moyer-Lee says. His involvement with trade unions stems from his time studying for a master's and then a PhD in economics at the School of Oriental and African Studies (SOAS), University of London. While there, Moyer-Lee - who is fluent in Spanish - became involved with the SOAS branch of Unison and started running English-language classes organised for Spanish-speaking cleaners. He later worked on a successful living-wage campaign for outsourced workers and started the 3 Cosas ("Three Things") Campaign that won pension rights as direct employees for the contract workers at the university.

His combative approach is hinted at in his retelling of how he joined the IWGB ("I had a very, very bad experience with Unison in terms of democracy," he says, tersely). Unison was accused of deliberately invalidating branch elections and so, in April 2013, Moyer-Lee, along with 100 or so other disgruntled members, walked out and formed the University of London branch of the IWGB. A Unison spokesperson said the split was the caused by "overly negative campaigning" that breached union rules and forced it to rerun the election. Now, the IWGB's six branches count 1,700 members (the vast majority of whom are cleaners, bicycle couriers and security guards), eight paid staff and around 40 elected officials.

For Moyer-Lee, even the term "gig economy" is problematic. "The fundamental defining feature of the gig economy, in my mind, isn't technology," he says. "It's because employers are keen to develop a way to not have liability towards these workers." What the technology has changed, he argues, is the types of industries now at risk of being disrupted by the gig economy. And it is here that Moyer-Lee sees potential for chaos. He gives an example: "Imagine in ten years you go into a Costa Coffee and none of the baristas are employees. But they're all standing by their macchiato machines and they have hats on that have five stars or four stars. You look around to see who has the highest star rating on their hat, go over to them, they make you a coffee, you pay them, Costa takes a commission and doesn't give them any holidays or minimum wage. There is no reason that couldn't happen if Uber is able to get away with this."

"The key thrust of [Uber's] argument at appeal stage was that they're acting as agents, introducing the driver to the passenger. The documents don't reflect that," says Rachel Mathieson, a solicitor on BWB's employment law team

Andrew Woffinden

The outcome of the Uber case now depends largely on the arguments put forward by the London law firm Bates Wells Braithwaite (BWB). While Powell and her colleagues at Leigh Day pursue a related group claim against Uber on behalf of around 70 drivers, BWB - the legal firm appointed by Farrar and Aslam when they moved from the GMB to the IWGB - is now spearheading the crucial test case. Based in an airy but squat building on the banks of the Thames, the firm is known for taking on cases for charities and social enterprises. "It's a bit of a myth to suggest that these new ways of working are imperilled by outmoded laws," says Paul Jennings, a bespectacled, middle-aged man with neat, grey-brown hair. Jennings is a partner on BWB's employment team, which is leading the case against Uber. "The courts have had to preside over cases involving priests, vicars, lap dancers, all sorts of atypical workers - and it can do so in a very nuanced way. That's the beauty of the common law: it adapts and it develops," he says. In the lively cast of characters taking on the gig economy, Jennings and his colleague Rachel Mathieson are the most cautious.

"The key thrust of the argument at appeal stage was that they're acting as agents, introducing the driver to the passenger. The documents don't reflect that," Mathieson explains. To date, Uber has failed to produce any evidence that shows it has an agreement with drivers that it is an agent, saying that this agreement is implied. "If you've got the most expensive legal teams in the country drafting a network of complex documents, why is the central document missing?" Jennings scoffs.

So why is it missing? Jennings surmises that it's likely because Uber's original legal argument rested on it being classified as a technology company. The fact it has conceded it's actually a transportation firm has left it open to attack. "It's a complete refocusing of the legal argument," he says. "It doesn't matter how good the lawyer is, I think there's a fundamental flaw in what they're saying, and they ought to concede."

With Farrar and Aslam's case against Uber being handled by BWB, Powell and her colleagues at Leigh Day are now working on a related claim against Deliveroo on behalf of more than 50 riders. Powell is representing people who work set hourly shifts. How the firm's couriers work varies by area: in some they can only work set shifts; in others they can only work on a pay-per-delivery basis. For all its riders, Deliveroo states that individuals are running their own food-delivery businesses and that Deliveroo is a customer of those businesses.

In July of this year, the Central London Employment Tribunal, the same body that heard the initial Uber case, will start hearing evidence from Leigh Day in its case against Deliveroo. As with Uber, Powell's legal arguments will rest heavily on the wording of Deliveroo's courier contract and the restrictions it places on riders, which she argues means they cannot be self-employed. She gives the example of an old Deliveroo contract that contained a clause preventing riders from bringing claims relating to employment rights. "You further warrant that neither you nor anyone acting on your behalf will present any claim in the Employment Tribunal or any civil court in which it is contended that you are either an employee or a worker," the clause reads. A subsequent clause states that should such a case be brought, the claimant must cover all of Deliveroo's legal costs and expenses. "Any competent lawyer would know that is unenforceable," she says. "They put it in there anyway, and the only possible reason is to scare people from enforcing their rights. That's the extreme end of this type of stuff."

Melisa Mutlu, 20, was a Deliveroo courier until she was fired in February 2017 for failing to meet service delivery standards. She is now one of the group of former and current riders represented by Leigh Day in the group claim against the firm. "I emailed them and asked, 'Could you tell me which of the standards I broke, so I know?' and they didn't get back to me." Mutlu earned £6 per hour and a £1 fee per drop while working as a Deliveroo courier - though that figure doesn't take into account the cost of maintaining and repairing her bike.

Her contract with the firm, dated October 2016, performs a series of semantic backflips to avoid referring to Mutlu as an employee. "You are a supplier of the business on your own account who wishes to join Deliveroo's supplier pool," it states. Under a section headed "STATUS", the contract explains, "You are a self-employed supplier and therefore acknowledge that you are neither an employee of Deliveroo, nor a worker". Another section concludes, "You are expected to be as flexible as you can to meet Deliveroo's needs".

Riders are told to adhere to a "dress code", which, despite requiring that riders wear either a Deliveroo-branded T-shirt or jacket, avoids the word "uniform" at every juncture. "You must keep your clothing clean and in a good state of repair," the contract states, before going on to explain, that "at all times when performing the Services you must wear at least one piece of Company-branded clothing". Deliveroo riders such as Mutlu, who work set hourly shifts, argue that such requirements make a mockery of their self-employed status.

"If you've got the most expensive legal teams in the country drafting a network of complex documents, why is the central document missing?" says Paul Jennings a partner on BWB's employment team

Andrew Woffinden

While cases against Uber, Deliveroo and others make their way through the courts and employment tribunals, the UK government is struggling in its attempts to reform legislation. In October 2016, Prime Minister Theresa May commissioned Matthew Taylor, chief executive of the Royal Society of the Arts and a former political strategy advisor to Tony Blair's government, to conduct an independent review into employment practices with a focus on how they need to change "in order to keep pace with modern business models". The report was published in July 2017 and, to the consternation of trade unions, did not recommend full employment rights for gig-economy workers. It did, however, propose new primary legislation to create a "dependent contractor" employment status. Such workers would be neither employed nor self-employed, but be entitled to holiday pay, sick pay, and, in most cases, pay equal to the national minimum wage. But in its response, the government has largely dodged the issue and failed to propose new legislation to force gig-economy companies to reform.

As the government drags its heels and the courts chew over case after case, Farrar is starting to lose his patience. "It's taken four years," he says. "If you have £1 million to spend on lawyers, and four years, you could do something. We shouldn't have to do that." And yet, improbably, Farrar and his co-claimant Yaseen Aslam have done pretty much that. From a pile of vomit on a London street, they are now two steps away from beating Uber at the Supreme Court - should the case even get that far.

"I like technology - I don't want to wind the clock back," Farrar says. "But I won't accept the bargains that we're given by Silicon Valley - this libertarian ideal that you must live and die by the sword. Somebody once said to me, 'Libertarianism is fine, so long as you're not a single mother on the top of a 20-storey block of flats,' and that's what it's like for these people. They'll preach this technological determinism, but they wouldn't live that way. I can accept the technology, but I can't accept that it must mean this level of exploitation. This is what Uber is saying. Well, we proved them wrong, because when we go to court, we win. In the end, the bullshit doesn't stand up."