Throughout the Syrian civil war, one of the major concerns of Western powers in particular has been the inflow of Sunni foreign fighters, who come from the wider Arab world, Western Europe, and as far afield as Kazakhstan and Indonesia.

According to a recent estimate by Aaron Zelin of the Washington Institute for Near East Policy, there could be up to 11,000 of these fighters. It raises the questions of which groups they join, and what the relations between these groups are.
By far the two most popular banners for these foreign fighters are al-Qaeda's official Syrian affiliate, the al-Nusra Front, and the Islamic State in Iraq and the Levant (ISIS).
ISIS is the result of a unilateral attempt by the leader of Iraq's al-Qaeda affiliate, Abu Bakr al-Baghdadi, to merge his group with al-Nusra. The move was rejected al-Nusra's leader, Abu Mohammed al-Julani, and by al-Qaeda overall leader, Ayman al-Zawahiri, but Baghdadi refused to disband ISIS.
Of the two organisations, ISIS appears to attract more foreign fighters.
They constitute a majority of ISIS's elite fighter corps and are disproportionately represented in its leadership, as opposed to native Syrian majorities on both counts in al-Nusra.
However, it would be a mistake to conclude, as is often reported, that ISIS in Syria overall is primarily a group of foreigners.
On the contrary, I would estimate at least a 60-70% Syrian majority in ISIS's Syrian branch.
This is because the group, bolstered by abundant financial resources, maintains extensive activist and service networks run by locals, such as the Islamic Administration for Public Services, which provides electricity and buses among other services in Aleppo.
In any event, ISIS is increasingly recruiting native Syrians to conduct important military operations, and understands that to perpetuate its existence in Syria, it must recruit from the next generation.
Hence, outreach to children is a key part of ISIS's modus operandi for consolidating power.
Besides al-Nusra and ISIS, there are several other groups to which foreign fighters congregate.
They are particularly concentrated in the Latakia countryside, near the Mediterranean coastline.
During the summer, these groups - along with al-Nusra and ISIS - played a leading role in an ultimately unsuccessful rebel offensive on Alawite areas, with the aim of scoring a symbolic victory by capturing President Bashar al-Assad's ancestral village of Qardaha.
Of these other groups, some are formations independent of both al-Nusra and ISIS, even though they have ideological affinity.
For example, primarily based in the Latakia countryside, there are the two groups Suqour al-Izz and Harakat Sham al-Islam.
The former, founded at the beginning of this year, is led by Saudi foreign fighters; the latter, established in the summer, is led by Moroccan foreign fighters.
Both have attracted fighters of other nationalities, including some Syrians.
Outside of Latakia, the most notable independent formations are the Green Battalion and Jamaat Jund al-Sham.
The Green Battalion is based in the Qalamoun area of Damascus province and was founded in the summer by Saudi fighters who are of similar ideological orientation to ISIS and al-Nusra but had personal problems both groups.
However, in the recent intense battles in Qalamoun with regime forces and Shia militias, the Green Battalion co-ordinated operations with ISIS and al-Nusra.
Jamaat Jund ash-Sham was founded last year by Lebanese fighters in western Homs governorate but has since incorporated many Syrians into its ranks. Ideologically, it is close to ISIS and al-Nusra, and nothing suggests personal tensions with either organisation.
Other foreign fighter groups are or have been mere fronts for ISIS. The most notable case is Jaysh al-Muhajirin wa al-Ansar, based primarily in Aleppo, Idlib and Latakia provinces.
In May, its leader- Omar al-Shishani - was appointed northern commander for ISIS by Abu Bakr al-Baghdadi, with authority over Aleppo, Raqqa, Latakia and northern Idlib provinces.
From that time until late November, Jaysh al-Muhajirin became synonymous with ISIS, both in its own discourse and in the eyes of other rebels.
Yet since late November, Jaysh al-Muhajirin has split, with Shishani and his followers now only identifying themselves as part of ISIS, and those wanting to operate as an independent group appointing a new commander: Salah al-Din al-Shishani.
Also in November, an independent group of foreign fighters in Latakia - the Lions of the Caliphate Battalion, led by Abu Muadh al-Masri - pledged formal allegiance to ISIS.
The concluding question that vexes governments is what kind of threat, if any, these foreign fighters may pose to the outside world.
Of all the above groups, ISIS most openly expresses the ultimately global nature of its struggle, in which the end goal is world domination, delusional as that may seem.
Indeed, it is likely for this reason that ISIS appears to be attracting the most foreign fighters, who generally come from global jihadist ideological backgrounds and already had this worldview before coming to Syria.
At the same time, ISIS fighters and supporters make clear to me that a fight against the UK, for example, is destined for the far future, after an Islamic state is established in Iraq and Syria and then extended throughout the Muslim world as a caliphate.
Some statements purportedly from ISIS and al-Nusra have appeared with threats to attack Turkey, but these have all been forgeries from pro-Assad circles.
As for the other groups, the testimony of one fighter who went to Latakia has suggested that Harakat Sham al-Islam is using Syria as a training ground to prepare to fight the government in Morocco - something that has otherwise not appeared in the group's discourse.
As an official al-Qaeda affiliate, al-Nusra is committed to a transnational project of a caliphate, but its leader and its native Syrian component tend not to talk openly about such a goal. Instead, they emphasise the more immediate objective of establishing Islamic law for the people of Syria.
Given the protracted nature of the conflict in Syria that will likely continue without a meaningful peace agreement for at least 10 to 15 years, the problem of inflow of foreign fighters will remain for quite some time to come.
At present, however, there is little that can be done beyond pressuring Turkey (which it can be argued has for a while turned a blind eye partly in the belief that the foreign fighters are useful proxies against Syrian Kurdish militias seen as the greater threat) to take rigorous measures to crack down on smuggling networks for foreign fighters and adopt more thorough vetting policies at airports.
To be sure, Turkey has always denied facilitating the inflow of foreign fighters, but testimony from both foreign fighters and those who run smuggling networks points to neglect on the part of Turkish authorities.
To a lesser extent, Iraq and Lebanon have also served as conduits for foreign fighters - both Shia and Sunni.
However it is not only lack of central government control over porous border areas which has enabled foreign fighters to reach Syria from Iraq and Lebanon.
Factionalism, sectarianism and dysfunction have also led to a lack of united effort and willpower to deal with the problem.
Aymenn Jawad Al-Tamimi is a student at Brasenose College, Oxford University, and a Shillman-Ginsburg Fellow at the Middle East Forum, who specialises in jihadist and ethnic minority militias in Syria. Follow on Twitter: @ajaltamimi


A couple's chance wedding photograph with members of New Zealand's Black Power gang has gone viral on Facebook.

Newlyweds Sarah and Matthew Oke were having their pictures taken at Lucy's Gully on the North Island when they ran into the gang members.
They were in the area paying respects to the dead as part of a traditional Maori "hikoi" at the mountain.
The gang members agreed to pose for a pictures with the couple, and even gave a salute.
Formed in Wellington during the 1970s, Black Power is a prominent gang made up of Maori and Polynesian members.
Some members have been linked to drug running and other organised crime.
Photographer Rebecca Inns, 31, who captured the moment on film, detailed the experience in a Facebook post.
"The rain had just cleared and we were enjoying a lovely sunny wedding shoot," she described. "As we headed back, we came across a very full car-park and the guys who were there as part of a hikoi."
"We asked if it would be okay to include them in a wedding photo and they were really accommodating. This is the result."
New Zealand's gangs
The unconventional photograph received 5,000 reactions on the site and was shared close to 600 times.
Some have praised it for helping to break down barriers and racial stereotypes.
Ms Inns, who said the couple had given her permission to share the photo, told the BBC that she was "completely taken by surprise" at the interest.
"Both parties just happened to be in the same place at the same time, both there for their own special reasons - and it has made for a wonderfully unique photo," she said.
"We definitely did not expect it to go viral when capturing the moment. But we pride ourselves on recording those unique moments in a couple's special day."
Ms Inns said the gang members had been "very respectful".
"They all offered their congratulations to the couple and were so kind. They also told the bride how beautiful she looked."
Reporting by the BBC's Heather Chen.


Ex-directors of failed parcel firm City Link are being prosecuted under section 194 of the Trade Union and Labour Relations (Consolidation) Act 1992.

They will be tried at Coventry Magistrates' Court on 5 and 6 November.
An Insolvency Service spokesman confirmed that "criminal proceedings have been commenced against David Smith, Robert Peto and Thomas Wright".
"We will not be commenting until the criminal proceedings have been concluded," they added.
The Insolvency Service said that the Department for Business, Innovation and Skills (BIS) was bringing the prosecution on its behalf.
Coventry-based City Link, owned by investment firm Better Capital, called in administrators on Christmas Eve after "substantial losses".
On New Year's Eve it announced 2,356 job losses after a bid to buy the company failed.  A week later it announced a further 230 redundancies.
The company was founded in 1969. It was bought by Better Capital for Â£1 in April 2013.


An England fan left with severe brain injuries after violence at the Euro 2016 tournament, has "opened both eyes" in hospital, his brother has said.

Andrew Bache, 51, from Portsmouth is in a critical condition after Russian fans went on the rampage with iron bars in Marseille on Saturday.
Dean Bache said his brother was still unconscious after being put in an induced coma.
But he had briefly opened his eyes and moved his arms, he said.
Mr Bache, who is also known as Pepe, suffered a cardiac arrest, extensive brain injuries and a lung infection after being attacked before England's match against Russia.
He opened his eyes when his son Harry visited him in hospital, Dean said in a message posted on a fundraising page.
Friends who launched an appeal to help him have so far raised more than Â£19,000 towards a Â£30,000 target.
Dean Bache said his brother would "have an operation in 10-15 days to repair his broken face".
He said: "I'm not ashamed to say I cried for the first time today...I was talking to him... and held his hand and he closed his hand and gripped mine."
Chief Marseille prosecutor Brice Robin said Mr Bache had been beaten around the head by Russians armed with iron bars.
A message from Dean Bache, shared on Facebook, read: "I was told that the chief inspector of the local police has informed them that they have excellent CCTV footage of the attack and have indentified those involved and pictures have been forwarded to French police."


A nine-month countdown to the introduction of compulsory age checks on online pornography seen from the UK has begun.

The April 2018 goal to protect under-18s was revealed as digital minister Matt Hancock signed the commencement order for the Digital Economy Act, which introduces the requirement.
But details as to how the scheme will work have yet to be finalised.
Experts who advised ministers said the targeted date seemed "unrealistic".
The act also sets out other new laws including punishing the use of bots to snatch up scores of concert tickets, and mandating the provision of subtitles on catch-up TV.
The age-check requirement applies to any website or other online platform that provides pornography "on a commercial basis" to people in the UK.
It allows a regulator to fine any business that refuses to comply and to ask third-party payment services to withdraw support.
The watchdog will also be able to force internet providers to block access to non-compliant services.
Ministers have suggested one of several ways this might work would be for pornographic sites to demand credit card details before providing any access, since in the UK consumers typically have to be over 18 to have a card of their own.
But the specifics are being left to the as-yet unappointed regulator to determine.
While it has been proposed that the British Board of Film Classification (BBFC) will assume this role, a spokesman for the Department for Digital, Culture, Media & Sport said the appointment would not be formalised until the autumn.
"We are already working closely with DCMS to ensure the effective implementation of the act," a spokeswoman for the BBFC told the BBC, but added that it was too early to say more about what guidance it might issue.
The measure has been welcomed by child protection charities including Childnet.
"Protecting children from exposure, including accidental exposure, to adult content is incredibly important, given the effect it can have on young people," said its chief executive Will Gardner.
"Steps like this help restrict access."
Mindgeek, which operates several of the world's most popular porn sites, has also previously indicated support.
But two experts who advised the government on its plans have expressed reservations about both how quickly the scheme is being rolled out and its wider implications.
"It seems to me to be a very premature date," commented Dr Victoria Nash, lead author of a report commissioned in the run-up to the law being drafted.
"The idea you can get a regulatory body up and running in that timeframe seems extraordinary to me.
"And while I don't have a problem with asking these companies to act responsibly, I don't see it as a solution to stopping minors seeing pornography."
This, she explained, was because the act does not tackle the fact that services including Twitter and Tumblr contain hardcore pornography but will not be required to introduce age-checks. Nor, she added, would teens be prevented from sharing copied photos and clips among themselves.
"It may make it harder for children to stumble across pornography, especially in the younger age range, but it will do nothing to stop determined teenagers," Dr Nash concluded.
One cyber-security expert on the same advisory panel was more critical.
"The timeline is unrealistic - but beyond that, this is one of the worst proposals I have seen on digital strategy," said Dr Joss Wright from the Oxford Internet Institute.
"There are hundreds of thousands of websites where this material can be accessed and you are not going to catch all of those.
"There's privacy issues - you're requiring people to effectively announce the fact they are looking at this material to the credit card authorities.
"And there's serious security issues from requiring people to enter their credit card details into untrusted sites.
"They may well say there will be other magical ways to do the age check, but I very much doubt they will be non-discriminatory [against adults without credit cards], transparent, privacy-preserving and secure for end-users."
Other topics covered by the act on which work can now formally begin include:
Some provisions set out by the act have already come into force, including the introduction of a "broadband universal service obligation" to give households the right to request download speeds of at least 10 megabits per second, and increased fines for firms behind nuisance calls.
"The Digital Economy Act is about building a strong, safe and connected economy," said Mr Hancock.
"It will secure better support for consumers, better protection for children on the internet, and underpin a radical transformation of government services."


People living with diabetes in some parts of England are eight times more likely to suffer an amputation than others, latest figures show.

Scarborough in North Yorkshire, has the joint highest rate of amputations along with Mansfield in Nottinghamshire.
They had 4.9 per 1,000 adults with diabetes, eight times more than Brent, north-west London, with only 0.6 per 1,000 patients in the past three years.
Overall, the number of patients having an amputation is on the increase.
According to the Hospital Episode Statistics and Quality and Outcomes Framework, there were 19,066 amputations carried out between 2009-12, and 22,109 between 2012-15 - an increase of 3,043.
Dave Campbell, from Scarborough, lost four toes due to complications with diabetes.
The true cost of type 2 diabetes
He says he got an ulcer in his foot which became infected, resulting in him having two toes amputated. The same thing happened again two years later.
"Fortunately I still have the big toe, which is very helpful as far as balance is concerned," he said.
"Everything I do has to be done at a slow pace."
Katharine Speak, the lead on diabetes and high-risk podiatry services in North Yorkshire, said people with diabetes may not always be getting the right treatment at the right time.
"We are not seeing the patient soon enough," she said.
"Sometimes they feel that they can deal with things themselves and once it's got out of control there is very little we can do to get it back."
Chris Gosling, from Scarborough's Diabetes UK support group, said: "There is the impression that Scarborough is a nice holiday town, but in fact it has one of the highest deprivation rates in Yorkshire.
"People aren't aware of the complications of diabetes, they do not have a GP possibly, there are a lot of hard to reach groups who don't use the medical facilities, and it is not diagnosed quickly enough."
Stephen Ryan, Regional Head of Diabetes UK said: "We know that up to 80% of amputations can be avoided with good diabetes care and improved footcare.
"We need to make sure that everyone with diabetes gets good quality annual foot checks and knows how to reduce their risk of foot problems, and that anyone who has a foot problem gets the right care to prevent or treat it.
"It is particularly important that if anyone with diabetes has a foot infection they get urgent attention from a multidisciplinary team of specialists."


Two RAF jets were scrambled to escort a private plane into Cardiff airport after it lost radio contact.

The Typhoons were launched from RAF Coningsby in Lincolnshire to identify an "unresponsive civilian aircraft", the RAF said.
Communications were re-established and the aircraft was safely escorted to Cardiff Airport, a spokesman added.
The Challenger 300 jet left the airport at 19:20 GMT, thought to be heading to its original destination, Dublin.
Cardiff Airport said the plane had temporarily lost radio contact.
"As a precautionary measure the aircraft was escorted into Cardiff Airport as a safe place to land," it said.
The airport added that it was open and operating as normal.
It is understood that one passenger and two crew were on board the private jet.
All the main emergency services sent crews to Cardiff Airport at about 16:30 BST, including seven fire appliances. Police and ambulance also attended.
The sonic boom caused by the RAF jets was heard across Oxfordshire.


A man has been jailed for at least 32 years for the "savage, pre-planned" murder of a woman found dead in a horse paddock.

Justin Robertson, 36, was paid Â£1,500 by Benjamin Carr, 22, to "silence" his former stepmother Pennie Davis after a long-running feud between the pair.
Robertson had denied murder but was convicted after a six-week trial.
Carr, from Southampton, was convicted of conspiracy to murder and will serve a minimum of 30 years.
Co-defendant Samantha Maclean, 28, of Beech Crescent, Hythe, was found not guilty of the same charge at Winchester Crown Court.
Robertson, of no fixed address, had been paid by Carr to attack Mrs Davis on 2 September last year over fears she would disrupt his father's wedding to his new partner.
He was given a life sentence for the murder.
Mother-of-five Mrs Davis, 47, was found dead by her new husband in a field at Leygreen Farm near Beaulieu in the New Forest, where she had been tending to her horses.
She had been stabbed 14 times in an attack described by trial judge Justice Andrew Popplewell QC as "particularly brutal".
During the trial, jurors heard Carr, the son of Mrs Davis' ex-lover, hired Robertson to kill her.
She had threatened to go back to police over sexual assault allegations first made against him when he was 14, the court was told.
It was part of a long-running feud between the pair.
The court heard Mrs Davis had been caught having sex with a former partner by Benjamin Carr while she was in a relationship with his father.
Carr's father Timothy was due to marry last summer and Mrs Davis messaged his fiancÃ©e on Facebook, telling her about the allegations she had first made almost 10 years before.
His son feared Mrs Davis would go back to police about the historical sexual abuse and conspired with Robertson to kill her.
Robertson's girlfriend, Lian Doyle, 24, also of Beech Crescent, Hythe, pleaded guilty to perverting the course of justice.
In a statement, Mrs Davis's family said: "The people responsible for our mum's brutal murder have been convicted, but we cannot celebrate.
"It is not them, but us, Pennie's family, who have been given the real life sentence. The life of someone precious to us as a mother, daughter, wife and sister has gone and can't be replaced."
Speaking outside court, Det Supt Paul Barton, of Hampshire Police, said: "Pennie was a loving mother who doted on all her children and was just starting a new chapter in her life with husband Pete."
John Montague, of the Crown Prosecution Service, said: "This is a tragic case where a mother-of-five who had just remarried died from a savage pre-planned execution.
"Her husband, Peter, made the terrible discovery when he found her dead near the horses that she loved so much.
"Our thoughts are with him, Mrs Davis' children and extended family."


Artists have structurally different brains compared with non-artists, a study has found.

Participants' brain scans revealed that artists had increased neural matter in areas relating to fine motor movements and visual imagery.
The research, published in NeuroImage, suggests that an artist's talent could be innate.
But training and environmental upbringing also play crucial roles in their ability, the authors report.
As in many areas of science, the exact interplay of nature and nurture remains unclear.
Lead author Rebecca Chamberlain from KU Leuven, Belgium, said she was interested in finding out how artists saw the world differently.
"The people who are better at drawing really seem to have more developed structures in regions of the brain that control for fine motor performance and what we call procedural memory," she explained.
In their small study, researchers peered into the brains of 21 art students and compared them to 23 non-artists using a scanning method called voxel-based morphometry.
These detailed scans revealed that the artist group had significantly more grey matter in an area of the brain called the precuneus in the parietal lobe.
"This region is involved in a range of functions but potentially in things that could be linked to creativity, like visual imagery - being able to manipulate visual images in your brain, combine them and deconstruct them," Dr Chamberlain told the BBC's Inside Science programme.
Alice Shirley - artist
"I had a very arty family. My mother was an art historian and my dad a photographer.
"I grew up surrounded by art and was encouraged to draw from a very young age, and I liked it so I did more of it. It was a combination of encouragement and enthusiasm that made me interested in pursuing art.
"It's just in the blood."
Alice spoke to BBC Radio 4's Inside Science Programme
For the full report, listen to Inside Science on BBC Radio 4
Participants also completed drawing tasks and the team looked at the relationship between their performance in this task and their grey and white matter.
Those better at drawing had increased grey and white matter in the cerebellum and also in the supplementary motor area - both areas that are involved with fine motor control and performance of routine actions.
Grey matter is largely composed of nerve cells, while white matter is responsible for communication between the grey matter regions.
But it is still not clear what this increase of neural matter might mean. From looking at related studies of other creative people, such as musicians, it suggests that these individuals have enhanced processing in these areas, Dr Chamberlain added.
"It falls into line with evidence that focus of expertise really does change the brain. The brain is incredibly flexible in response to training and there are huge individual differences that we are only beginning to tap into."
Another author of the paper, Chris McManus from University College London, said it was difficult to distinguish what aspect of artistic talent was innate or learnt.
"We would need to do further studies where we look at teenagers and see how they develop in their drawing as they grow older - but I think [this study] has given us a handle on how we could begin to look at this."
Commenting on the small sample size, Prof McManus said: "Since the results were statistically significant then clearly there was the power to find something, which almost by definition means it was large enough.
"And also of interest is that other people have also had hints at effects in similar locations. Obviously in an ideal world we'd like 1000 subjects, but that isn't realistic. It's always a compromise between cost, practicality and interest."
Ellen Winner of Boston College, US, who was not involved with the study, commented that it was very interesting research.
She said it should help "put to rest the facile claims that artists use 'the right side of their brain' given that increased grey and white matter were found in the art group in both left and right structures of the brain".
"Only a prospective study could get at the question of innate structural brain differences that predispose people to become visual artists, and this kind of study has not been done as it would be very difficult and very expensive to carry out."


Labour leader Jeremy Corbyn says he can "still be prime minister" as he aims to thwart Theresa May's attempt to run a minority government.

He told the Sunday Mirror: "This is still on. Absolutely."
Labour will set out its own programme for government as an amendment to the Queen's Speech, focusing on austerity and a "jobs-first Brexit," he says.
He told the BBC's Andrew Marr he will call on MPs from all other parties to back his policies instead of Mrs May's.
Shadow foreign secretary Emily Thornberry told Sky News Labour are "absolutely on our toes" to set up an alternative minority government if Mrs May's government falls apart, accusing the Conservative PM of "squatting in Downing Street".
Mrs May is seeking a loose "confidence and supply" arrangement with the DUP's 10 MPs that would allow her to press ahead with a minority government, after losing her Commons majority in Thursday's general election.
The Conservatives could command a majority with the support of the DUP if they manage to to do a deal with the Northern Irish party.
Labour gained 30 seats in Thursday's general election to take its total to 262 seats, but the Conservatives remain the largest party in Parliament with 318 seats. This is more than the total of Labour, Lib Dems, SNP, Plaid Cymru and Green Party. The number needed for a majority is 326.
This would give the Tories the numbers to pass a Queen's Speech on Monday 19 June, which will set out their legislative agenda.
But shadow chancellor John McDonnell said he believes there is a majority in Parliament to maintain the winter fuel allowance and "triple lock" state pension guarantee, two policies the Conservatives proposed changing in their manifesto.
He told ITV's Peston on Sunday: "I believe the DUP is in favour of scrapping the bedroom tax. There's a whole range of issues like that where we think there'll be a majority in Parliament."
Jeremy Corbyn said he did not think Mrs May had any credibility and it was "unclear" what kind of programme the Conservatives would be able to put forward.
He said there was a "possibility" of voting down the Queen's Speech and Labour were going to "push all the way" to achieve that.
Speaking on the BBC's Andrew Marr show, he said Labour would put down a "substantial amendment to the Queen's speech" based on the main policies in its general election manifesto, with an emphasis on Brexit, young people, and austerity.
He said the Brexit content of that amendment would be about negotiating as quickly as possible a "jobs-first Brexit".
Mr Corbyn said his party was "quite ready and able to put forward a serious programme of government", which he said "obviously has massive support in this country."
He also said he believed that the Great Repeal Bill - the Conservative plan to copy across all EU laws into UK law - would now become "history" - and that there would be "something different" in a few weeks' time.
He told Andrew Marr he thought it was quite possible there could be an election later this year, or early next year, which he thought "might be a good thing."
"We can't go on with a period of great instability" he said, adding that the Labour Party was ready to fight another election campaign.
On Brexit, Mr Corbyn said he wanted "tariff-free access to the European market" and to maintain membership of key European agencies, as well as  European Convention on Human Rights and European Court of Human Rights but he confirmed he would press ahead with leaving the EU if he became prime minister.
He also suggested he was ready to build bridges with some of the Labour MPs who have opposed his leadership.
Asked if Yvette Cooper and Chuka Umunna - both of whom had been reported to be planning leadership bids if Labour lost seats in the general election - could come back to the front bench, Mr Corbyn said: "I am the most generous person in the world."
Ms Cooper, who was defeated by Mr Corbyn in the 2015 Labour leadership contest, said the Parliamentary party had "changed a lot" since last year's EU referendum and was now fully behind Mr Corbyn.
"We all need to pull together to take on Theresa May and take on the Tories," she told Sky News.
She did not rule out accepting a job in Mr Corbyn's shadow cabinet, but said she did not want to be "presumptuous".
She said the Conservatives' planned deal with the DUP was "dodgy" and "unsustainable" - and Theresa May's position was "not remotely tenable" because she lacked the skills to hold together a minority government, which has to be more open and collegiate.
She said Labour had to be ready for another election "at any time" and warned the party not to "rest on its laurels," saying it had to work on how to win back more seats from the Conservatives.
In an interview with BBC Radio 4's Today programme on Saturday, Chris Leslie, Labour MP for Nottingham East, refused to say whether he thought Mr Corbyn was a credible prime minister.
He said: "We shouldn't pretend that this is a famous victory. It's good as far as it's gone, but it's not going to be good enough."
He said the party had missed an "open goal" in failing to win a majority.
"You've got to convince them of your credibility and that you can move from protesting about the government to being in government," he said.
Get news from the BBC in your inbox, each weekday morning


A total of 10,000 online dating profiles has been sold to the BBC's Panorama programme, many of which were fake.

The Information Commissioner's Office (ICO) has said it will investigate the sale.
The ICO said the sale of this information could be "a significant breach of data protection principles".
The profile seller Edgars Apalais has denied that people did not give consent for their contact details to be shared.
The programme was sent photographs and lists of names, email addresses, dates of birth and details of sexual orientation by the website Usdate. Some profiles included photographs of celebrities such as Brad Pitt, Michael Caine and the TV chef Rick Stein.
Some of the contact details sold were genuine. The email addresses of academics, a House of Lords life peer and BBC employees were included on the list. All of these individuals told the programme that they had never used a dating website.
Gerald Masterson tried online dating a couple of years ago but said he did not meet anyone and stopped using the websites.
He was surprised to learn that his personal details had been sold to Panorama as part of the bulk purchase of fake profiles.
"I am angry and feel they have taken my identity…. I feel it's just a money-making scam," he said.
It is a breach of data protection law if someone sells your information without consent and if the information is inaccurate. The material sold to Panorama appears to meet both criteria.
The man who sold the BBC these profiles calls himself Edgars Apalais. Panorama tracked him down to the Dominican Republic and eventually he agreed to an interview. We secretly recorded the conversation.
He denied that people had not given their consent for their contact details, photographs or personal information to be shared.
"This is sensitive personal data. I'm very concerned to see that these lists are being sold on. You've got lists about these individuals' sexuality," said Simon Entwisle, Director of Operations at the Information Commissioner's Office, the body responsible for ensuring companies protect private data.
"If you're talking about significant numbers of names, that's a significant breach of the data protection principles potentially,"
You can watch Panorama - Tainted Love: The Dark Side of Online Dating Monday 29 July at 20:30 BST on BBC1 and then on the BBC iPlayer in the UK.


Investigators in Russia say they cannot rule out the possibility that an attack downed a jet over the Black Sea, with the loss of all 92 passengers and crew.

An external "mechanical impact" could have caused Sunday's disaster, a flight safety official said, while confirming there had been no explosion.
But he added that it was just one of many theories, including technical failure and human error.
The defence ministry airliner was bound for Syria at the time.
Russian media have published what they said was the pilots' final conversation, reportedly transcribed from a flight recorder recovered from the wreckage.
It suggests that the Tu-154 jet's wing flaps - panels which help lift an aircraft - were not moving together, causing the crew to lose control.
Analysis of the plane's "black boxes" may not be completed until the end of January.
On board the plane were 64 members of the famed Alexandrov military music ensemble, still known as the Red Army Choir, who were due to perform for Russian forces in Syria.
The plane, which was 33 years old, crashed soon after take-off from Adler airport near the city of Sochi, where it had landed for refuelling, en route from Moscow.
It came down in good weather, close to the shore, with no survivors.
Nineteen bodies and more than 230 body fragments have been recovered in a massive search of the sea, along with 13 big fragments of the plane and about 2,000 smaller fragments.
"There was no explosion on board," Lt-Gen Sergei Bainetov, the Russian air force's head of flight safety, told reporters on Thursday.
"But this isn't the only type of terrorist act... It could have been any type of mechanical impact, so we don't rule out a terrorist act."
Around seven theories that include poor quality fuel causing engine failure and a bird getting caught up in the engines are being investigated, he added, quoted by Reuters news agency.
"There is no leading theory," he stressed.
However, Russian Transport Minister Maxim Sokolov told the same news conference: "The version of a terror attack isn't being considered as the main version."
Russian officials previously suggested terrorism was not being considered as a possible cause of the crash.
Piercing alarm sounds
Alarm sounds about dangerous proximity to the ground
The Tupolev airliner was an old model no longer flown by airlines in Russia but still used by the military.
If the final conversation attributed to the crew proves to be genuine, it could indicate either a mechanical fault or a fault by the crew, such as mistakenly retracting the flaps instead of the undercarriage.
Mechanical v human: Why do planes crash?


Lego products are becoming increasingly violent as toymakers engage in an "arms race" to catch children's attention in the digital age, a new study says.

New Zealand researchers say bricks with weapons have steadily become more commonplace and are now included in 30% of Lego kits.
The study said Lego reflected a broader trend in children's entertainment.
Lego says weapons are always used for a wider purpose such as saving the world, and are part of a child's development.
In a peer-reviewed study published by the online journal PLOS ONE, researchers from the University of Canterbury concluded that Lego "showed significant exponential increases of violence over time", with a higher proportion of weapons appearing among Lego's building blocks and themed kits.
Lego's first weapons were issued in 1978 when a castle kit included swords, axes and lances.
"The Lego company's products are not as innocent as they used to be," lead researcher Christoph Bartneck said.
"The violence in Lego products seems to have gone beyond just enriching game play," he added.
An analysis of Lego catalogues from 1973 to 2015 found the scenarios depicted had also become more violent, with 40% of all pages containing some type of violence such as shooting or threatening behaviour.
"To catch the attention of their customers, toy manufacturers are similarly locked in a metaphorical arms race for exciting new products," the study said.
Lego spokesman Troy Taylor said the company's products promoted a range of play activities such as construction, fantasy and conflict.
"As with other play types, conflict play is a natural part of a child's development," he was quoted as saying by AFP news agency.
"We always try and use humour where possible as it helps tone down the level of conflict," he added.
Lego almost went bankrupt in 2003-4 as electronic games threatened its future.
The Denmark-based company tried to reinvent itself by embracing popular culture, selling themed kits linked to popular movie franchises such as Star Wars, Batman and Harry Potter.
The result has been 11 straight years of growth, with the company announcing earlier this year that net profit in 2015 soared 31% to $1.4bn (almost Â£1bn).


A 15-year-long study into the affect childhood lifestyle has on adult health will continue with new funding.

The EarlyBird study has followed 300 young people from the age of five since 2000 to measure the impact of childhood diet and exercise on later life.
Plymouth University academics behind the study believe it is the only one of its kind in the world to follow the same children for such a long period.
Funding of Â£500,000 will now allow the project to continue until 2017.
EarlyBird3 has won the funding from Plymouth University, Plymouth Hospitals NHS Trust, the Clinical Research Network: South West Peninsula, which is part of the National Institute for Health Research, and NestlÃ© Institute of Health Sciences Ltd.
The study has weighed, measured and investigated children in the Plymouth area to see how their lifestyles, diet and exercise patterns affect their health - especially diabetes.
EarlyBird previously found modern children were "at quite substantial risk" of the condition.
The third phase of the project will also explore the childhood origins of dental, psychological and respiratory health problems.
Jonathan Pinkney, professor of endocrinology and diabetes at Plymouth University Peninsula Schools of Medicine and Dentistry, said: "Not only will this give us a better understanding of how such diseases develop, it will also help us to identify methods for disease prevention and when in our life development it is best to implement those."
The study organisers are re-recruiting members of the original group.


The way in which every single cancer cell spreads around the body has been captured in videos by a team in Japan.

The normal body tissues show up as green, while the cancer comes out as intense red spots.
The team, at the University of Tokyo and the RIKEN Quantitative Biology Center, says the technology will help explain the deadly process.
The research is on mice so far, but it is hoped the method could one day help with treatment too.
The spread of cancer around the body is a crucial moment called metastasis.
Before a cancer spreads it is easier to contain and cure, afterwards it is incredibly difficult.
The tumour itself has to evolve so bits of it are able to break free, survive travelling in the blood stream and invade new tissues.
A deeper understanding of how this happens could lead to new ideas for treatment.
The mice were injected with cancerous tissue engineered to fluoresce.
The researchers then let the disease progress before using chemicals that made the mouse's body and internal organs highly transparent.
It meant the body could be rapidly imaged and the location of any cancerous tissue detected.
The study, published in the journal Cell Reports, details cancers growing in the lungs, intestines, and liver before spreading around the body.
Dr Hiroki Ueda, one of the researchers, said: "The images reveal cancerous colonies in enough detail to calculate their shapes, volumes, and distributions - characteristics critical to distinguishing between patterns of metastasis.
He told the BBC News website: "We are now applying this technology to the human clinical samples.
"I hope this tissue-clearing and 3D imaging of human samples will make diagnosis easier, more objective and accurate in near future."
Watch an infection take hold in 3D and in real time
Further experiments showed how cancer can get better at spreading.
Dr Kohei Miyazono said: "Most of the cancer cells appear to die during circulation in the bloodstream and fail to metastasise."
But cancers then start producing chemical signals to help them grow.
The researchers tested the effect of one of them, called TGF-beta, and showed it dramatically improved the chances of cancers colonising the lung tissue.
"[They] are far more likely to survive the journey and form malignant outposts," Dr Miyazono added.
It is thought the technology could be adapted to other disciplines, including how the body's cells behave in people with autoimmune diseases.
Follow James on Twitter.


The BBC has learned that police have reopened an investigation into a senior Archery GB coach.

The coach was suspended by Archery GB (AGB) last month following a complaint to police over an alleged incident involving a young female Para-athlete.
Less than three weeks later, AGB announced in a statement on their website that the suspension of the coach had been lifted after they had been informed that "no new information or evidence has been received, and that there is no live UK police investigation in relation to this matter".
The BBC can reveal that police have now reopened the investigation into the alleged sexual assault, which is understood to have taken place in the last four years while overseas at an international competition.
The former athlete told the BBC in June that she did not pursue her original complaint at the time because she felt threatened after staff at the sport's governing body implied she could lose her funding, and cost the coach his job.
AGB said the case was "investigated and dealt with at the time, to the satisfaction of the alleged victim and [a relative] of the alleged victim".
However, following the BBC report, the AGB said it received a call from the alleged victim who confirmed contact was made with the police.
This led to the suspension of the coach, before it was overturned on 20 July.
AGB have not commented on the current employment status of the coach.


An influential US senator has said he will withhold consent for arms sales to Gulf Arab states until there is a "path forward" to resolving the Qatar crisis.

Bob Corker, the chairman of the Senate foreign relations committee, warned that efforts to fight so-called Islamic State and counter Iran were being hurt.
Saudi Arabia, the United Arab Emirates, Bahrain and Egypt cut air, sea and land links with Qatar three weeks ago.
They accused Qatar of aiding terrorist groups and Iran - charges it denied.
On Friday, the emirate was presented with a 13-point list of demands to end the crisis that included shutting down the Al Jazeera news network, cutting ties to the Muslim Brotherhood, and curbing diplomatic relations with Iran.
A government spokesman in Doha said the list confirmed that "the illegal blockade has nothing to do with combating terrorism - it is about limiting Qatar's sovereignty, and outsourcing our foreign policy".
The restrictions have caused turmoil in the oil- and gas-rich nation, which is dependent on imports to meet the basic needs of its population of 2.7 million.
President Donald Trump initially expressed his support for the actions taken against Qatar despite it hosting the largest US military base in the Middle East.
But his Secretary of State, Rex Tillerson, acknowledged on Sunday that some of the demands issued by its neighbours would "be very difficult to meet" and called for "dialogue leading to resolution".
In a letter sent to Mr Tillerson on Monday, Mr Corker said he had been pleased with Mr Trump's recent trip to Saudi Arabia, where he attended a summit of the Gulf Co-operation Council.
The Republican noted that the president had agreed with the GCC's six member states, including Qatar, to "ease regional conflicts" and establish "deeper security co-operation".
"Unfortunately, the GCC did not take advantage of the summit and instead chose to devolve into conflict," he added.
"All countries in the region need to do more to combat terrorism, but recent disputes among the GCC countries only serve to hurt efforts to fight [IS] and counter Iran."
"For these reasons, before we provide any further clearances during the informal review period on sales of lethal military equipment to the GCC states, we need a better understanding of the path to resolve the current dispute and reunify the GCC."
Under US law, Congress must be formally notified 30 days before the sale of any weapons to foreign governments, giving lawmakers time to block it if they object.
Last month, a resolution seeking to stop the sale of about $500m (Â£393m) of precision-guided munitions to Saudi Arabia for use in the Yemen conflict - part of a $110bn (Â£86bn) arms deal negotiated by Mr Trump in Riyadh - was only narrowly defeated in the Senate by 53 votes to 47.


National League side Bromley have signed former Liverpool youngster Michael Ngoo.

The 24-year-old forward, who never made a first-team appearance for the Reds, has been without a club since leaving Scottish side Kilmarnock last year.
Ngoo had loan spells with Hearts, Yeovil Town and Walsall during his time with Liverpool, before leaving Anfield in the summer of 2014.
He is eligible to make his debut for the Ravens against Chester on Saturday.


LG has announced a modular Android smartphone that can gain extra functions via add-on parts.

Components are plugged in by pulling off the base of the G5 phone and swapping it for an alternative unit.
Google is known to be working on a modular phone of its own, but the concept is far from mainstream.
One expert said the idea would help LG stand out from its rivals, but added that it was too soon to know whether it would turn around the firm's fortunes.
The firm also announced new virtual reality kit and a remote control robot at its Mobile World Congress press conference in Barcelona.
In January, LG reported that its smartphone shipments had fallen by 2% in 2015 despite the market as a whole growing by about 10%.
LG revealed two optional modules - which it calls "friends" - alongside the new mobile handset.
One is a 32-bit digital to analogue converter (DAC) made by the audio specialist Bang & Olufsen, which it says makes the phone capable of playing sounds at a higher resolution - meaning music should be more detailed when heard via good quality headphones or speakers.
The other module is a camera controller that the company says should make it easier for owners to take pictures using only one hand. It features a dial for zooming and a button to take photos among other controls, and also provides a 40% boost to battery life.
A spokesman for LG told the BBC its engineers were working on further modules, and it hoped other third-party manufacturers would also add to the ecosystem.
Switching between modules involves pulling out the phone's battery and attaching it to the new part. Although this makes the action more fiddly, it does have the benefit that the battery can be easily replaced, unlike in many other handsets.
Another unusual feature about the phone is that it comes with two camera lenses on its back.
One is a normal lens, while the other creates 135-degree wide-angled shots that LG says offer a larger field of view than the human eye or any other smartphone.
This can be useful for capturing landscapes or group shots of people. However, the wide-angled photos only have a resolution of eight megapixels - half that of those taken via the other lens.
The phone also has an "always-on display", which uses part of the screen to show the user the time and notifications without them having to wake it up. Despite its name, the display does turn off when the handset detects it is in a pocket.
LG has also followed Samsung in launching its own virtual reality kit.
Unlike its domestic rival's headset, LG's 360 VR does not use the phone as a screen but rather features two built-in displays of its own - one for each eye.
The advantages are that the machine:
LG has yet to announce its price, but has acknowledged that it will be more expensive than Samsung's.
The company also showed off a handheld camera that can capture 360-degree videos, which can be watched on any VR headset or uploaded to Facebook and YouTube.
Unlike the headset, the camera will be compatible with all phones running Android 4.2 or higher or Apple's iOS system.
The final accessory unveiled at MWC was a robotic ball with a built-in infrared blaster.
This can be controlled from afar by the smartphone, allowing the user to see and talk to people in their home and control IR-equipped appliances.
LG was relatively late to the smartphone market, only launching its first Android handset at the end of 2009.
It is currently the world's sixth best-selling smartphone brand, according to IDC.
However, the research firm's data indicates that LG's market share dropped from 4.6% to 4.2% over the course of 2015.
That suggests recent attempts to make itself stand out - including offering leather-clad phones and models with curved screens - have failed to resonate with as many buyers as hoped.
One company watcher, however, suggested that the G5's standout feature had more promise.
"There's very few examples of expandable modules in handsets - Handspring had the Springboard expansion slot [in 1999] for its PDAs, and of course more recently there's Google's Project Ara," said Ian Fogg from the IHS Technology consultancy.
"What's striking is that the idea is against the main thrust of the market, which has been to integrate everything, even the battery, into the phone so nothing is removable.
"But there's a lot of potential. If you can make a phone where the hardware is versatile you open up more opportunities for innovation - not just for what you build, but potentially for what others build too."
Follow all the BBC's MWC coverage via the "Mobile World Congress 2016" tag in our news app.
You can also keep track of our technology correspondent Rory Cellan-Jones and the rest of the team covering the Barcelona event via a dedicated Twitter list.


Super League side Warrington Wolves have announced Ryan Bailey, Jordan Cox and Mitchell Dodds will leave at the end of their contracts.

Ex-Leeds prop Bailey, 31, joined after the start of the season and made 15 appearances for Wire.
Forward Cox, 24, arrived on a one-year deal from Hull KR while Australian prop Dodds, 27, had an injury-hit season.
"I'd like to thank all three players for their contributions over the season," said head coach Tony Smith.


A sculpture featuring thousands of handmade ceramic poppies commemorating those who died in World War One is to be installed in Hull.

Weeping Window is to be installed at the Maritime Museum in the city centre for two months in 2017.
The building, formerly the Dock Offices, tells the history of the city's mariners.
The site has been chosen to highlight sacrifices made by the Merchant and Royal Navies, said Hull City Council.
Much of Hull's fishing fleet was requisitioned for mine-sweeping and many fishermen helped the war effort.
More on this story and others from East Yorkshire and the Humber
Artist Paul Cummins and designer Tom Piper saw their full poppy installation, named Blood Swept Lands and Seas of Red, draw more than five million visitors to the Tower of London in 2014.
Each poppy represented one death in the British forces, a total of 888,246.
The Weeping Windows poppies are to be displayed in Hull from 22 March to 29 May 2017.
Hull is to be the UK's City of Culture 2017.


More illegal mobile phones were found in Kirkham prison last year than in any other jail, government figures have revealed.

The figures show 488 mobile phones and SIM cards were seized at the Lancashire prison - 200 more than any other prison in England and Wales.
The category D open prison, near Preston, houses 562 male prisoners.
Over 1,000 of the 7,451 handsets or SIM cards confiscated across England in 2013 were found in north west jails.
Possession of a mobile phone in prison is illegal and is often associated with the supply of drugs.
Prisons Minister Andrew Selous revealed the figures in a written parliamentary answer to Labour's Jim Cunningham.
He said the seizures showed the success in clamping down on the use of banned items.
The National Offender Management Service has begun supplying some prisons with mobile phone blocking technologies.
The Ministry of Justice refused to disclose whether Kirkham prison uses mobile phone blockers to stop prisoners using banned handsets.
A spokesperson said: "Mobile phone blocking technologies have already been trialled in ten prisons and in October 2013 a further 300 short range portable mobile phone blockers were rolled out to prisons."


One of the UK's largest housebuilders has called for a "critical reassessment" of green belt land to help solve Britain's housing shortage.

Legal & General chief executive Nigel Wilson said that if 1% of green belt was released for building, it would be enough for up to one million new homes.
And the L&Q housing association said Britain faced a choice: build on "green field" or continue with a shortage.
The comments come ahead of a major government announcement on housing.
A controversial white paper on revitalising England's housing market, which has been delayed three times, could now be published next week.
It is expected to propose a relaxation of planning rules and that local authorities should be allowed to build more council houses for rent as well as purchase.
"The green belt has doubled in size in the last 20 years, it is 4 million acres now," Mr Wilson told the BBC.
"We've got to have a much greater critical assessment on what is and what isn't green belt.
"Nobody wants to build on the Chilterns, or the Malvern's or the beautiful parts of Britain, but there are lots of areas that have been designated green belt which are really brown field sites and we absolutely have to build on more brown field sites," he added.
Theresa May has set a target of building a million new homes by 2020, a target that many house builders believe will be missed.
Sajid Javid, the cabinet minister responsible for housing, has said the government's plans will be "radical".
Mr Wilson said: "I think there was a great obsession in the UK with house price inflation, the way you get house price inflation is denying supply and that is what has happened for 30 years in the UK."
"We have to reverse that going forward - as we go from Nimbyism, not in my back yard, to Pimbyism, please in my back yard," he said.
The moves on releasing more land were backed by David Montague, the chief executive of L&Q housing association, which builds thousands of affordable homes for purchase and rent.
"If you look at what we're doing here in Barking Riverside [in east London], we're building 11,000 new homes on brown field land, and of course it makes sense to prioritise brown field land," Mr Montague said.
"But if you go just a few miles up the road to Chelmsford in Essex, we are working there on a green field site with a Tory council with the support of the local people to produce a 4,000 home new town.
"The key thing is that we need an adult conversation about where we're going to build these homes.
"The alternative is that we just deal with the consequences of not building enough homes and that means more people in temporary accommodation, more people living on the streets, more people not about to afford to buy a home of their own, it means rising waiting lists for rising housing benefit bills.
"We have a choice, we either find the land to build the homes we need, or we deal with the consequences of not doing that."
The government knows that any moves to relax planning regulations will be controversial.
Green belt land often surrounds towns and cities where people want to live, and so is highly prized by developers.
Shaun Spiers, chief executive of the Campaign to Protect Rural England (CPRE), said that unravelling the green belt risked losing precious countryside.
"We are an incredibly crowded country, the most populous big country in Europe, and [green belt] is the countryside nearest to where people live," he said.
"It stops towns merging into each other, it is an incredibly valued resource. There is loads of land with planning permission in the country already.
"There is enough brown field land to build over a million homes. We don't need to be building on the green belt to solve the housing crisis," Mr Spiers said.
CPRE figures reveal that 360,000 houses have been proposed for green belt land in England - up from 81,000 in 2012 - as local authorities come under pressure from the government to hit the one million homes target.
Although the housing white paper will only deal with England, there is anecdotal evidence that similar controversies over green belt protections have affected Wales, Scotland and Northern Ireland.


An investigation to help understand gambling addiction and its impact on health in Wales has been launched.

About 1.1% of the Welsh population are problematic gamblers, according to recent figures from the Gambling Commission.
Researchers from Bangor University and Public Health Wales (PHW) are hoping the research will lead to better support for those with addictions.
Prof Mark Bellis of PHW said it was important to understand the risks.
He said: "Developments in the gambling industry and related advertising mean it is important that we understand the risks to public health in Wales represented by the gambling industry and that we work with partners to ensure that everyone, but especially the most vulnerable, are protected from any associated harms."


Former BHS owner Sir Philip Green has vowed to sort out the pensions "mess" that followed the collapse of the retailer last month.

The billionaire told MPs that his advisers were working on a "resolvable and sortable" solution for 20,000 members of the BHS scheme.
He said he would sit down as soon as possible with the regulator and would give it his "best shot".
Sir Philip also said he had offered to help Sports Direct buy BHS.
He said Sports Direct's founder, Mike Ashley, had offered to buy the business and keep the shops trading until Christmas 2016. Sir Philip added that he had even offered to put in a "few million", but that the total on the table was not sufficient.
The pension scheme is now in the Pension Protection Fund, meaning that members will receive less money than they had expected.
Sir Philip, whose retail empire includes Topshop, was appearing before a joint hearing of the Business and the Work and Pensions select committees, which are investigating the demise of the department store group.
He has come in for criticism for the £400m in dividends taken out of the firm during his 15-year ownership, his management of the pension scheme, and the sale of BHS in 2015 to former racing car driver and bankrupt Dominic Chappell, who had no retail experience.
At the start of almost six hours of tetchy exchanges, Sir Philip apologised for the collapse of BHS, which is expected to result in up to 11,000 job losses.
"There certainly [was] no intent on my part for anything to be like this. It didn't need to be like this," he said.
But he said he was working on a plan for the pension scheme, which was in surplus when he bought BHS but now has a £571m deficit.
"We want to find a solution for the 20,000 pensioners," he said. "It's current and in motion." He took blame for the pensions "mess", saying: "It's my fault".
Sir Philip told MPs the new plan, being drawn up by Deloitte, would offer BHS pensioners a "better outcome" than compensation available from the Pension Protection Fund, a lifeboat scheme that helps finance pensions when companies go bust.
However, he declined to give more details of the plan. When asked if it meant scheme members would receive the pensions due before the collapse, Sir Philip said: "We are trying to fix this mess."
He rejected suggestions that he had sucked money out of BHS. Sir Philip told MPs that his Arcadia retail empire had invested £800m in BHS in an attempt to turn around a business that "structurally was in the wrong shape".
Asked when he first considered selling BHS, Sir Philip replied that it was 2014. He added that there was "no thought process - perhaps there should have been - it would have saved a lot of aggravation".
He said: "Would I do that deal again? No." Mr Chappell was "unfortunately the wrong guy" to buy BHS.
But Sir Philip said Mr Chappell had endorsements from lawyers, accountants and banks. He took comfort from the advisory firms Grant Thornton and Olswang, which acted on behalf of Mr Chappell, although he now thought they didn't know him "from a hole in the wall".
Asked about Mr Chappell's previous bankruptcies, Sir Philip said that should not necessarily count against him. "Entrepreneurs do bad deals. That doesn't mean they can't go back into business."
He also defended his use of the tax haven Monaco to run his operations, saying: "I don't accept that it is tax avoidance. With respect, if you look at our corporate structure, there is a lot of stuff written and I don't want to talk about other companies, it is not my style.
"I could have been a lot more aggressive than I probably was. Every penny our company has made in the United Kingdom has paid tax."
The businessman said he only left the UK because of a heart scare: "When I went there [Monaco], I had no idea I was ever going to do any more business."
In an extraordinary exchange, Sir Philip stopped mid-sentence at one point to rebuke Richard Fuller MP for "staring" at him.
He said to Mr Fuller: "Sir, do you mind not looking at me like that all the time, it's really disturbing. You just want to stare at me, it's uncomfortable."
Mr Fuller replied: "I don't wish to make you feel uncomfortable, Sir Philip... I think it is another parliamentary colleague that is known for his death stare."
MPs have already taken evidence from Mr Chappell, the pensions regulator and advisers on the sale of BHS.
After the hearing, the committee chairs, Iain Wright and Frank Field, said they may have further questions for Sir Philip. They are already planning to recall Mr Chappell.
Mr Wright told the BBC: "What was quite clear was that he was not used to being questioned. One of the things that really struck us was the ability of him to have quite vivid recollection of detail such as where that £7m went, but in terms of ten years of pension schemes which went from surplus to deficit he didn't know anything, and we were trying to push him on that - that curious mix, that contradiction between knowing the detail and knowing nothing at all is something we really want to push.
"How can somebody extract hundreds of millions of pounds from a business and then sell it to somebody who isn't putting any equity into it himself and it crashes in 13 months - how can that be allowed to happen?"
Mr Field added: "This guy, Dominic Chappell, who was a fantasist - how could he ever have been taken by anybody, seriously?"


A cyclist who killed a Royal Navy veteran by pushing him to the ground during a dispute has been jailed for manslaughter.

Roy Galvin, 69, from Alverstoke, died from a fractured skull three days after he was attacked in Bury Road, Gosport.
Duncan Snellgrove, 28, flew into a rage when Mr Galvin's wife questioned his friend for cycling on the pavement, Portsmouth Crown Court heard.
Snellgrove was jailed for three years and four months.
Mr Galvin had been walking home from a local pub with wife Deborah, who was in a motorised wheelchair, on 25 September.
Snellgrove and his friend Lee Walker, who had a young boy on the handlebars, were cycling in the opposite direction and Mrs Galvin asked Mr Walker to go on to the road.
Mr Galvin then made a comment about the child being "too young" to be riding on the handlebars and the court heard Snellgrove "took exception" to this and began "fronting up to him".
Snellgrove, of Mandarin Way, Gosport, then pushed Mr Galvin to the ground.
Mr Galvin hit his head, suffering a "medically untreatable" brain injury.
Snellgrove then fled the scene and Mr Galvin died at Queen Alexandra Hospital three days later.
Sentencing, Judge Sarah Munro QC told Snellgrove: "Your actions have deprived a delightful couple of many happy years together."
The court heard Snellgrove has 17 previous convictions for 29 offences, several for violent attacks, dating back to when he was 14.
Mr Galvin served in the Royal Navy for 24 years as an aircraft engineer before retiring in 1987.
He gained medals for long service, conduct, and for serving in the Falklands War and South Arabia.
Mrs Galvin, his wife of 12 years, said she had been left traumatised by "the terror of the incident".
"I just can't seem to get it out of my head," she said.
"Roy was my total companion and we had a lot of fun sharing our lives together. He was incredibly intelligent and very, very, funny. He just loved life and was my best friend in the world."


Workers at the drinks giant Diageo have voted to take industrial action in a dispute over pensions.

Unions said the action could affect all of Diageo's 50 sites in Scotland, as well as other locations in Northern Ireland and Cheshire.
The dispute is over plans to move staff from a final salary pension scheme.
Diageo described the move as "clearly disappointing", adding that it was "premature" as talks between the company and unions were ongoing.
Both GMB Scotland and Unite members voted in favour of action, which could take place in the run-up to Christmas.
In Scotland, Diageo runs 29 distilleries and two bottling plants at Leven in Fife and Shieldhall, Glasgow.
Its brands include Johnnie Walker, Bells, Talisker and Dalwhinnie.
GMB Scotland, which has 1,200 members working with Diageo in Scotland, said members voted for strike action by a majority of 63% and action short of strikes by a majority of 69.7%.
Scotland organiser Louise Gilmour said: "Our members have sent a strong message to Diageo that the company needs to think again if it wants to avoid damaging strikes across Scotland.
"Diageo is happy to significantly increase executive pay in the wake of billions of pounds of profit but they won't protect the pensions of the workforce who have contributed massively towards the success of the business."
Unite, which has more than 700 members at Diageo sites around the UK, said its ballot showed 82% in favour of industrial action short of a strike, and 77% in favour of strike action.
It said sites in Scotland, Northern Ireland and Runcorn, Cheshire, could be affected by the dispute.
Unite regional officer Pat McIlvogue said: "We are proud of our members, who have sent a clear message to Diageo that they must keep their pension promises.
"No-one takes industrial action lightly - especially with Christmas coming up - but Diageo is behaving like Scrooge."
Diageo said it had been holding a consultative review with employees of its final salary pension scheme since February this year.
In a statement it said: "This process has involved detailed discussions on the future of the scheme and employee pension priorities as well as a proposal for change.
"More recently the company and union representatives concluded discussions at ACAS which resulted in an alternative proposal for change."
On the outcome of the ballots, Diageo said: "This is clearly disappointing and the company feels premature whilst we were in ongoing discussions.
"The company and employees are in a consultative process and have not yet moved into consultation on the alternative proposal.
"It is also far from the positive industrial relations of past decades that the company has had with its employees and which has helped build the reputation our supply business has today."
It added: "If and when strike action is taken the company will focus on ensuring that our business continues as usual as far as possible."


The Northern Ireland economy minister has said he wants to apologise to a whistleblower who raised concerns about the financial cost of the failed renewable heat incentive scheme.

The failed scheme could cost taxpayers £400m.
On Thursday, the whistleblower said it was evident there were "opportunities for fraud" in the scheme.
She said she contacted Arlene Foster, the then enterprise minister, in 2013 to warn about the issue.
Speaking on BBC's The View, Simon Hamilton expressed regret that the woman's complaint was not taken seriously by Stormont civil servants.
"I want to thank [her] for her contribution and to apologise to her for the fact that her complaint was not taken seriously by government. It was taken seriously, however, by Arlene Foster, who passed the information on to her officials, and that's absolutely the right thing."
He defended the first minister, saying she has "shown leadership" and has nothing to hide.
"The communication from the whistleblower was not specific about what the alleged abuse of the scheme was and it was appropriately passed on by Arlene to her officials, who were tasked to investigate it," he said.
"It was they who didn't take the complaint seriously."
1, 946 applications were approved under the non-domestic Renewable Heat Incentive scheme - a 98% approval rate.
984 of them were received in just three months - September, October and November 2015 - after officials announced plans to cut the subsidy but before the change took effect.
The assembly's Public Accounts Committee was told that a subsequent independent audit had found issues at half the 300 installations inspected.
14 of these fell into the most serious category where fraud was suspected.
Payments to five of these 14 sites have been suspended.
He added that "no recommendation was brought forward to bring in cost control measures and the issue hadn't actually crystalised during her time in the department".
"People are asking should she resign. She absolutely should not resign as she has done nothing wrong," he said.
"Arlene, like me, sees the importance of getting to grips with this incredibly serious issue. I'm not going to sit here and say anything other than that this is a shocking situation and one that needs to be dealt with."
Mr Hamilton said he and the first minister are working on a plan that will reduce the cost to Northern Ireland taxpayers.
"This issue is the number one priority for my department and I hope to bring forward the details of that plan early in the new year."


Plans to replace four primary schools with two new ones have been backed by Powys council.

Ardwyn, Grungrog, Oldford and Ysgol Maesydre nursery and infants schools will all shut from August.
The area's first Welsh medium primary school will be created at the current Ysgol Maesydre site to replace them.
The council originally dropped plans for a Welsh school in the 1990s in the face of a large campaign. There was just one objection to the latest plan.
A new English-medium Church in Wales school will also be built near Welshpool High School after the council's cabinet backed the recommendations in a report.
The new schools will operate from the existing sites for the 2017-18 academic year.


A 14-year-old boy who died when he fell through the roof of a disused warehouse while "exploring" has been named.

Mylo Johnstone was with friends at the site off Wyther Lane, Kirkstall, Leeds on Thursday at 20:30 BST when he fell onto the building's concrete floor.
Paramedics gave emergency treatment but he died at the scene.
Two boys were seriously hurt in similar incidents in the city in recent weeks, prompting police to warn children against entering abandoned buildings.
Det Insp Phil Jackson, of West Yorkshire Police, said: "I think they were exploring and being mischievous, there was a group of 14-year-old boys and unfortunately Mylo Johnstone fell to his death.
"While we are still carrying out inquiries into this incident, every indication is that this has been a tragedy with no suspicious circumstances."
Officers have carried out forensic examinations at the scene, with Leeds City Council and the Health and Safety Executive also involved in the investigation.
Tribute messages left at the gates outside the warehouse complex described Mylo as a "lovely lad" who would be "sorely missed".
On 20 June, a 12-year-old boy was injured at a disused factory in Modder Avenue, Armley. A 13-year-old boy was hurt at a derelict building in Ninelands Lane, Garforth, on 28 May.
"We are obviously coming up the school holidays and clearly there is potential for young people to be tempted to try to explore abandoned sites," Det Insp Jackson said.
"We would ask that they think very carefully about the dangers this involves, as has been starkly illustrated by these incidents, and that they consider the consequences that could have on their lives and the lives of their families."
He added: "I know they might be really interesting and intriguing to look through, but some of these buildings are death traps."


Glamorgan led by 103 on first innings against Leicestershire as 20 wickets fell on a remarkable day at Grace Road.

Timm van Gugten took 5-52 to pass 50 Championship wickets for the season as Leicestershire were bowled out for 96 in just 29.3 overs before lunch.
Teenager Kiran Carlson top-scored for Glamorgan with an unbeaten 74, but three wickets each from Neil Dexter and Clint McKay saw them all out for 199.
Leicestershire reached a relatively sedate 78-0 in their second innings.
Leicestershire batsman Ned Eckersley told BBC Radio Leicester:
"It was a bizarre day of cricket and definitely wasn't forecast at the start, the pitch was a little bit soft but fine.
"I'm at a loss to explain it. For our first innings a few of us, myself included, will be disappointed in the manner of the dismissals.
"But in all fairness and credit to us, to comeback from being bowled out for 96 and bowl them out, to have that fight and keep taking wickets like we did, was very impressive.
"We have given ourselves a chance of winning the game going into day two."
Glamorgan batsman Kiran Carlson told BBC Wales Sport:
"It was quite a tough wicket to get started on and that showed with a lot of people getting out early but, as soon as you got in, it flattened out a little bit as you saw with their openers at the end of the day.
"We need to come back again strongly, if we take a few quick wickets early we can make inroads in the afternoon.
"It's nice to follow up my hundred at Chelmsford and do well again in the last game of the season.
"Timm van der Gugten has been on fire the whole season, he's missed a couple of four-day games and still managed to take 50 wickets, so that's brilliant."


The body of a 32-year-old man who had earlier been reported missing has been found in the Castlebay area of the Isle of Barra.

Police Scotland said the body was recovered from the shoreline at about 07:00 on Thursday.
There are not believed to be any suspicious circumstances at this time and the man's next of kin have been informed, police said.
Police have appealed for sightings of the man on Wednesday.
He is described as being 5ft 10in tall and was last seen wearing a green top and brightly-coloured trainers.
A man matching the description was seen walking from Castlebay in the direction of Vatersay from about 14:00 on Wednesday.
The body was found in the Traigh a' Ghoirtein area of Barra.
Police, the Scottish Fire and Rescue Service and the Maritime and Coastguard Agency were called to the scene.


A debut novel inspired by a dollhouse in Amsterdam's Rijksmuseum has been named Waterstones Book of the Year.

The Miniaturist by Jessie Burton is the story of a young bride in a wealthy quarter of  17th Century Amsterdam.
As a wedding gift she is given a miniature replica of her own house whose contents seem to mirror real life.
Actress turned writer Burton, 31, said her latest achievement was "a complete honour".
"I'm so delighted that they picked me," she told the BBC. "I feel I must have made some pact with the devil and he's coming to get my soul at some point."
Published in July 2014, The Miniaturist is the best-selling literary debut hardback of the decade so far.
Burton also won the new writer of the year prize at the National Book Awards last week.
The Oxford graduate wrote the book over four years while working as an actress and as a PA in a City firm. The idea for the novel was sparked by a holiday in Amsterdam in 2009.
In the Rijksmuseum she saw a dollhouse that belonged to Petronella Oortman, the wife of a 17th Century silk merchant. Commissioned in 1686, it was a exact copy of their real home
"I was very fascinated by this house and I stood in front of it for a lot longer than anybody else," said Burton.
"The thing that caught my attention was the fact that she spent as much money on it as her real house. I thought: 'Why?'"
The book was the subject of a publishers' bidding war in April 2013 at the London Book Fair.
Waterstones' managing director James Daunt called the book "a first novel of vivid excitement" and said it "richly deserved its stunning success".
Burton, who has appeared on stage at the National Theatre and had a role in BBC children's series The Wild House, said it was "a thrill, a pleasure and a true honour" to be named this year's winner.
"It's all any writer could wish for," she continued. "I will always be grateful for this incredible award."
The eight-strong Waterstones shortlist included Richard Flanagan's Man Booker Prize-winning novel, The Narrow Road to the Deep North, and Helen Macdonald's Samuel Johnson Prize winner, H is for Hawk.
Last year's winner was John Williams' Stoner, a US novel first published in 1965 that became an unlikely bestseller in 2013.


The funeral of actor Frank Kelly, best known for his role as Father Jack Hackett in Channel 4 comedy Father Ted, has taken place in Dublin.

Ardel O'Hanlon, who starred alongside Kelly in the show, and its creators Graham Linehan and Arthur Matthews, were among the hundreds of mourners.
Irish President Michael D Higgins was also there to pay his respects.
Speaking after the service, Matthews said Kelly had been "a legendary figure in Irish comedy".
Kelly, who died on Sunday, spent 60 years in theatre and on screen, most recently in Emmerdale and Mrs Brown's Boys D'Movie, but is best remembered as the ill-tempered perennially-drunk priest Father Jack in the hit show.
Addressing the mourners at the Church of the Guardian Angels in Blackrock, Kelly's son Emmet said it had been "pretty cool" that Father Jack was trending on Twitter shortly after his death, ahead of Donald Trump and Leonardo DiCaprio.
Despite his well-known role though, chief celebrant Father Bill Fortune said Kelly had been a devoted churchgoer.
Pointing to the seat Kelly had taken "Sunday after Sunday", Fr Fortune said it was "probably contoured to his person".
The service also saw a copy of the Irish Times crossword, which he did every day, and a picture of the 40 Foot swimming hole in Dublin Bay, where he took a daily dip, brought to the altar.
Speaking outside the church, Matthews said Kelly "had a great life".
"He packed a lot in. He'll be missed, he was a legendary figure in Irish comedy," he said.
The actor is survived by his wife of 51 years Bairbre, seven children and 17 grandchildren.


A Yes campaigner has denied that she lied about an MP assaulting her on the day of the independence referendum.

Patricia McLeish was asked by defence lawyer Liam Ewing if she had made the whole thing up as part of a political campaign and replied: "Certainly not."
Marie Rimmer, Labour MP for St Helen's and Whiston, is on trial at Glasgow Sheriff Court accused of assaulting Miss McLeish outside a Glasgow polling station on 18 September 2014.
The 69-year-old denies the charge.
She also denies behaving in a threatening or abusive manner on the same day, by repeatedly approaching volunteers and pointing in the face of Dennis Ashcroft.
Miss McLeish, who is a Unison convenor and member of Solidarity, gave evidence during the second day of the trial, which began in April.
She also denied that after the alleged assault she had called Tommy Sheridan, the leader of Solidarity.
Mr Ewing accused Miss McLeish of chanting: "Vote Yes and get Tories and red Tories out."
She told Glasgow Sheriff Court that she would have used the phrase "New Labour Tories" and added: "I wasn't shouting. I had swollen glands that day."
The public sector employee claimed that Miss Rimmer asked her where she worked and then was "in her face".
She denied a suggestion that there had been a heated argument on both sides which had been sparked by talk of politics in Liverpool in the 1980s.
Miss McLeish said she was handing out leaflets outside the polling station at Shettleston community centre on September 18, 2014, with another Yes campaigner, and Miss Rimmer was campaigning for the No camp.
She told the court: "The accused came in to my face twice. She asked me if I was a shop steward and I replied 'yes'.
"The next piece of conversation was 'where do you work'. I said local government and she said she was the leader of St Helen's Council.
"I thought after she claimed to be the leader of a council that she obviously had mental health difficulties."
Miss McLeish told the court she was kicked on the left shin by Miss Rimmer and reported the incident to the presiding officer.
The trial before sheriff Kenneth Hogg continues.


Samsung has launched its mobile wallet service Samsung Pay in South Korea.

It joins Apple - which launched a rival facility last year - in trying to convince shoppers to use their handsets, rather than plastic cards, to make in-store purchases.
And Samsung believes it has one critical fact that will work in its favour: its tech works with a much larger number of existing payment terminals.
In truth, it's still unclear whether using mobiles to buy goods offline has much appeal beyond a novelty factor when it comes to non-geek members of the public.
But with two of the biggest names in tech betting their mobile payment services will help their handsets stand out, the days of slipping a bulky wallet into your pocket or handbag could be numbered.
At launch, Samsung Pay is only available in the company's home country.
But it will expand to the US on 28 September, and the firm has indicated that the UK, Spain and China will be next to get the facility sometime in the near-future.
That signals a more aggressive rollout than Apple Pay, which currently remains limited to the US and UK.
However, there are two other additional factors to consider.
Samsung Pay will only work with the firm's newest Android smartphones:
And bank/credit card providers involved must be signed up to the scheme.
Unlike Google Wallet and several other earlier payment apps, there's no need to unlock the phone and launch a special app to get started.
Assuming you've already entered your payment card details, all you need do is swipe up from the bottom of the device's face and Samsung Pay will appear, even if the screen was turned off to begin with.
Next, pick a credit card and scan your fingerprint or provide a Pin code.
Finally, you have to bring the phone close to the payment terminal within 15 seconds to complete the sale.
No - it should be able to work with two existing types of widely used kit.
Like Apple Pay, Samsung's service is designed to work existing "tap-and-go" terminals that use near field communication (NFC) transmissions. This is the technology that was widely deployed across the UK alongside the introduction of chip-and-pin cards.
But Samsung Pay's added trick is that it also works with magnetic stripe readers, which remain popular in the US and Asia.
This is thanks to a proprietary technology it calls Magnetic Secure Transmission (MST).
"Rather than swiping the card, which normally transmits the data, we are using electronic signals [made by alternating current through] coils inside the phone to send the signal over," Thomas Ko, vice president of Samsung Pay, explained to the BBC.
"So, from the machine's perspective it is actually receiving the same amount of information that it would from a magnetic reader."
Samsung has been able to deploy the innovation thanks to its takeover of LoopPay - an American company that initially tried to pioneer the tech via bulky add-on smartphone cases.
Is that safe? Couldn't someone steal my account details by "eavesdropping" on the transmission?
Payment cards have indeed been successfully targeted by thieves who clone the details coded on their magnetic stripes.
However, Samsung Pay uses a security system called tokenisation to protect against this threat.
Rather than transmitting the same, static "primary account number" (Pan) each time, a Samsung Pay handset instead sends:
These two sets of data are sent to the payment processor, who checks they correspond before authorising the payment.
Even if a thief were able to get close enough to intercept the transmission, there is no way for them to reverse-engineer the token to deduce the victim's card account details.
And they would not be able to use the token with another magstripe reader unless they also had a way to generate a matching cryptogram. That should should be next to impossible to do without access to the encryption key.
The system works without changes having to be made to the magstripe machine itself. It treats MST transmissions as if they are a traditional card swipe.
Yes - but it's unlikely that many people will be swayed from Apple's iOS ecosystem solely because of the type of mobile payments Samsung supports.
Perhaps the more important comparison is with Android Pay - Google's forthcoming mobile wallet service.
Google is also pitching its service as simple to use because it doesn't need a special app to be launched. But it will require payment terminals to offer NFC support.
Even so, one shouldn't totally discount app-based rivals - especially if they can offer distinctive services of their own.
In South Korea Kakao Pay also allows users to make money transfers to each other and AliPlay does something similar in China. Meanwhile, in the US the forthcoming CurrentC service is promising "exclusive offers" to its users.


Mae rhan o bier Bae Colwyn wedi cwympo i'r môr.

Cafodd swyddogion peirianyddol cyngor Conwy eu hanfon i'r safle, ond bydd rhaid aros tan bod y llanw allan er mwyn gwneud asesiad o'r difrod, a beth yn union ddigwyddodd.
Mae'r pier wedi bod ar gau i'r cyhoedd ers 2008 ac yn ôl adroddiadau does dim awgrym fod unrhyw un wrth y pier pan gwympodd.
Yn 2013 fe wnaeth cynghorwyr Conwy bleidleisio i ddymchwel yr adeilad gwag oedd wedi bod yn newyddion oherwydd ffrae gyfreithiol ynglŷn â phwy oedd yn berchen ar y safle.
Ar y pryd dywedodd y Cyngor eu bod yn gwario £53,000 bob blwyddyn ar gynnal a chadw'r strwythur a adeiladwyd yn 1900.
Yn ôl y cyngor, roedd angen £15m i adnewyddu'r pier.
Cafodd cais y cyngor sir i ddymchwel y pier ei wrthod gan Lywodraeth Cymru yn 2015.
Wythnos yn ddiweddarach yn yr un flwyddyn fe wnaeth Steven Hunt, dyn busnes lleol, fethu yn ei ymdrech yn yr Uchel Llys i adennill meddiant o'r adeilad.
Cafodd y safle ei drosglwyddo i ofal Cyngor Conwy yn 2012.
Dywedodd Cyngor Conwy mewn datganiad: "Fe fyddwn ni'n gwybod mwy pan fydd y llanw allan a swyddogion yn medru gwneud archwiliad manylach.
"Mae ardal waharddiedig wedi'i sefydlu o amgylch y pier ac fe fydd yr ardal yn cael ei ailasesu er mwyn sicrhau diogelwch y cyhoedd. Mae swyddogion Adnoddau, Iechyd a Diogelwch ar y safle ac yn delio gyda'r sefyllfa."


Mo Farah missed out on a fifth major championships distance double in a row as he finished second in the 5,000m at the World Athletics Championships.

Media playback is not supported on this device
The 34-year-old, who won 10,000m gold eight days ago, was swamped by his rivals in the final lap and Ethiopia's Muktar Edris broke clear to win gold.
Britain's Farah kicked again to take silver at the London Stadium in his final major track championships.
Britain's men won a stunning 4x100m relay gold as the women took silver.
"It's been a long journey but it's been incredible," Farah told BBC Sport.
"It didn't quite hit home until after I crossed the line and had a couple of moments to myself when I realised - this is it.
"I gave it all - I didn't have a single bit left at the end."
Four-time Olympic champion Farah will finish his track career with a record of 10 golds and two silvers in major championships.
He is set to focus on marathons after his final track appearance at the 5,000m Diamond League final in Zurich on 24 August.
Gold and silver in the two 4x100m relays takes Britain's medal tally at London 2017 to four - Farah supplying the other two - but the hosts are still two short of UK Sport's target of six to eight.
Edris, 23, ran a superbly judged final 600m to claim his first major title with a sprint finish reminiscent of so many Farah triumphs.
After a brief burst from Farah's compatriot Andrew Butchart at the front of the race, the Ethiopian trio of Edris, Yomif Kejelcha and Selemon Barega moved up to box in the home favourite.
Barega fell back but Edris used Kejelcha as a pace-setter into the home straight before surging away while Farah battled for position with the resurgent Paul Chelimo behind.
Farah finally found open track but Edris was gone, with the Briton passing the fading Kejelcha and holding off Chelimo to salvage silver.
"The 10,000m took a lot more out of me than I realised," said Farah.
"I was trying to cover every move but they had a game plan - one of them was going to sacrifice himself and that's what they did and the better man won."
Farah has now lost just two of his 22 5,000m contests since 2011.
"I was highly prepared for this race and I knew I was going to beat Mo Farah," said Edris, who won in a time of 13 minutes 32.79 seconds to claim his first win over the Briton in five attempts.
"I am the new champion for Ethiopia, that's why I did the 'Mobot' [Farah's traditional celebration] - I am the next champion."
1976 Olympic 10,000m bronze medallist and BBC commentator Brendan Foster: "We did say fatigue was going to get him. It has to come to an end. He hates losing."
BBC athletics expert Allison Curbishley: "In my head and my heart I didn't think anyone could genuinely beat Mo Farah but that 10,000m at the start of the week took so much out of him. Edris, we take our hat off to you. This man has beaten the legend that is Mo Farah in his own back yard."
2005 marathon world champion Paul Radcliffe: "He just doesn't have the pace in his legs anymore to be able to live with challengers like that but this isn't the end of Mo Farah in athletics. He has a new challenge ahead of him in the marathon."
Two-time Olympic decathlon champion Daley Thompson: "He has got to be hurting. But it has to end for everybody. In a couple of weeks or months, he will look back and say, 'that was awesome'."
2004 Olympic 4x100m relay champion Darren Campbell: "There are athletes out there who have won more medals, but the quality of those medals and for Mo to have led an event on his own... wow. I don't know how you can't see him as our greatest ever athlete."
Media playback is not supported on this device
A disconsolate Farah dropped to the track as Edris mimicked his famous celebration, before finally picking himself up to complete a farewell lap.
Farah has come under scrutiny in recent years, with his coach Alberto Salazar under investigation by the US Anti-Doping Agency.
The Briton also recently denied any wrongdoing after computer hackers revealed some of his blood samples had initially been flagged as suspicious, before later being declared normal.
After initial shock at the result, the crowd found their voice to give Farah a final warm send-off at the stadium he lit up with double Olympic gold in 2012.
"Back in 2008 at the Olympics I was so disappointed [at not making the 5,000m final] and I didn't know what to do with myself, whether to carry on with the sport," said Farah.
"I had to decide what it took to become a champion and that was to move to the other side of the world - nothing was guaranteed but I took that chance.
"This London crowd is amazing - there is no place like home.
"I have a few more races on the track, then I will take a short break and then this chapter of my life is closed."
Elsewhere, Britons Katarina Johnson-Thompson and Morgan Lake finished fifth and sixth respectively in the high jump as Maria Lasitskene - the Russian competing as a neutral athlete - won gold with a leap of 2.03m.
And Ashley Bryant finished 11th in the men's decathlon, with Kevin Mayer becoming the first French world champion in the event.
Media playback is not supported on this device


Police have raided a dozen apartments across Germany in an operation to arrest right-wing extremists plotting attacks, federal prosecutors say.

Deutsche Welle reported that suspected members of Reichsbuerger group were allegedly planning attacks on police officers, asylum-seekers and Jews.
About 200 officers were involved in the operation.
The federal prosecutor's office said the raids targeted six people accused of founding the group.
A seventh person is suspected of helping obtain supplies for them, including arms and ammunition.
The 12 raids took place in Baden-Wuerttemberg, Berlin, Brandenburg, Lower Saxony, Rhineland-Palatinate and Saxony-Anhalt.
No details of any arrests have been released.
A statement from the prosecutor's office said: "The goal of today's search measures was to obtain further evidence of the actual creation of a formal group, as well as the alleged planned criminal acts and any potential tools."
The suspects were largely connected via social media, said Deutsche Welle, and were believed to have begun planning armed attacks in spring 2016.
However, the news website said investigators had not found "concrete" evidence pointing to a terror attack.
The Reichsbuerger ("Reich Citizens") group does not recognise the authority of the post-war German federal republic.
It believes in the continued existence of a German empire, or Reich, dating back to 1937 or even earlier.
Bavarian officials said the group's ideology was "nationalist and anti-Semitic... clearly extreme right".