Labour has lost a number of former strongholds to independent candidates campaigning on pro-Gaza platforms.
In one of the biggest shocks of the night, shadow minister Jonathan Ashworth lost his Leicester South seat, which had a majority of more than 22,000.
The party's vote is down on average by 11 points in seats where more than 10% of the population identify as Muslim.
In Ilford North, shadow health secretary Wes Streeting was among those who saw his majority slashed - from more than 9,000 to 528.
But Labour managed to win back Rochdale from George Galloway.
Overall it was a spectacular night for Labour, with the party winning a landslide victory.
However, in areas with a high proportion of Muslim voters the party performed badly.
Labour has lost five seats with large Muslim populations - four to independents and one to the Conservatives.
In Leicester South, Shockat Adam declared "this is for Gaza" as he won the seat by 979 votes.
The constituency, where around 30% of the electorate are Muslim, has been held by Mr Ashworth for 13 years.
In nearby Leicester East, the Conservatives benefitted from independent candidates picking up several thousand votes, particularly the area's former Labour MP Claudia Webbe.
Ms Webbe, who was expelled from the party after she was charged and later convicted of harassment, has been a vocal pro-Palestinian campaigner.
The Tories won her former seat by 4,426 votes, less than the number secured by Ms Webbe.
In Birmingham Perry Barr, Labour's Khalid Mahmood lost to independent Ayoub Khan by 507 votes.
Meanwhile, independent candidates who made the conflict in Gaza central to their campaign won in Dewsbury and Batley, as well as Blackburn, which both previously had healthy Labour majorities.
Other senior Labour figures in areas with large Muslim populations only narrowly held their seats after seeing their majorities eaten away.
The newly elected Labour MP for Coventry South, Zarah Sultana, said her party's position on Gaza was a "stain on its record" and, while the party had "moved in the right direction", it "took a long time to get there".
David Lammy - who could be set to become Labour's foreign secretary - told the BBC that his party would "work with partners to seek Palestinian recognition" in power.
In Ilford North, independent candidate Leanne Mohamad, who is the granddaughter of Palestinian refugees, was just 528 votes behind Mr Streeting.
In Birmingham Ladywood, shadow justice secretary Shabana Mahmood held off a challenge from independent candidate and lawyer Akhmed Yakoob, who has a large following on TikTok.
However, her majority fell from more than 32,000 to 3,421.
Similarly Jess Phillips, who quit the Labour frontbench to vote for a Gaza ceasefire in Parliament last year, also saw her majority slashed from 13,141 to just 693.
Jody McIntyre, who stood for Mr Galloway's Workers Party of Britain, came second.
Ms Phillips faced shouts and booing as she gave her speech after the result, describing the campaign as "the worst election I have ever stood in" and claiming her activists had faced intimidation.
In Bethnal Green and Stepney, in east London, shadow small business minister Rushnara Ali, who was defending a majority of more than 31,000, beat independent candidate Ajmal Masroor by just 1,689 votes.
At his own count, Labour leader Sir Keir Starmer faced heckles of "Free Palestine" and saw his majority cut, with pro-Gaza independent Andrew Feinsten coming second with 7,312 votes.
In Islington North, his predecessor as Labour leader, Jeremy Corbyn, retained his seat as an independent, after being suspended from the party over his response to a report on antisemitism in Labour.
Mr Corbyn beat the Labour candidate by more than 7,000 votes.
However, in Rochdale, Labour's Paul Waugh ousted Workers Party leader Mr Galloway, just months after he won the seat in a by-election dominated by the Gaza conflict.
Labour has faced growing pressure over its stance on the conflict, since Israel launched a military campaign in response to Hamas's unprecedented attack on 7 October.
In February Labour called for an immediate humanitarian ceasefire in Gaza but critics said the party was too slow to reach that position.
In its manifesto, Labour has committed to recognising a Palestinian state.
Last year, Sir Keir was criticised after appearing to say Israel had the "right" to cut off water and energy to Gaza.
He later clarified that he meant only that the country had a right to self-defence.