It was an unexpected moment on the campaign trail.

Labour leader Ed Miliband had stopped his campaign bus in the northwest England city of Chester when he was mobbed by a bachelorette party waving iPhones and chanting "Selfie! Selfie!" Miliband, often depicted as a geek, offered a few weak high-fives, posed uncomfortably with the women in pink sashes draped over their dresses and then hurried back onto the bus.

Twitter lit up with Labour supporters sharing video of their man and his adoring fans.

"It worked in quite a good way for him," said Tom Mludzinski, head of political polling at the ComRes polling agency. "People wanted to be seen with him."

Ed Miliband is nerdy. Awkward. Shy. But those traits may not stop him from becoming Britain's next prime minister.

Miliband's Labour Party is in a virtual dead heat with Prime Minister David Cameron's Conservatives ahead of Thursday's vote. Since Britons choose the party and lawmaker they want, and don't directly elect the head of government, Miliband could end up running the country, even though he often looks as if he'd rather be anywhere but standing in front of a television camera.

"There's good evidence from the past to show this can and does happen," said Tim Bale, author of "Five Year Mission: The Labour Party under Ed Miliband." Clement Atlee, who was elected in 1945 and is often listed among Britain's best post-war prime ministers, also had little personal appeal, he said.

"He had absolutely zero charisma and he was facing the hero of all time in Winston Churchill," Bale said. "And he wins."

If Labour wins, it would mean a significant shift to the left for Britain after five years of Conservative-led austerity. Miliband, whom critics call "Red Ed," has promised to slow budget cuts, increase taxes on the wealthy and protect the rights of low-paid workers.

"It is only when working people succeed that Britain succeeds," Miliband, 45, said in introducing the Labour Party program. "Because I believe the wealth, the success, the future of our country does not simply come from a few at the top."

Miliband, the son of Jewish refugees who fled the Nazis, learned his politics at home.

His father, Ralph Miliband, escaped from Belgium and served in the Royal Navy during World War II. Working days and studying nights, he earned a doctorate and ultimately became one of Britain's foremost Marxist academics. Ed's mother, Marion Kozak, immigrated to Britain from Poland.

Their home was a magnet for academics and intellectuals, immersing Ed and older brother David in leftwing politics from a young age. Both brothers — more centrist that their father — chose careers in politics, transitioning from conversations around the dinner table to the House of Commons with ease. While both served in government and were marked for stardom, David held more senior positions and was seen by many as the heir to former Prime Minister Tony Blair.

But when Gordon Brown resigned after losing the 2010 election, Ed surprised many observers by challenging David for the party leadership. Ed got the backing of the unions, outmaneuvered his brother, and won the race by the slimmest of margins.

Ed has been dogged by the David question ever since. London Mayor Boris Johnson, a senior Conservative, last month called Miliband a "back-stabber" and said he would "do more damage to this country than he did to his brother."

Miliband has shrugged and moved on.

"Whatever is chucked (at him) he'll be downcast for a day and then he'll come back again," said Bale. "He's got enormous resources in that sense. He's very resilient."

Miliband can be accused of lacking definition — having failed to deliver either big vision or attack-style opposition. That inability to rise above the mushy middle can hurt, particularly when the unexpected happens. During one of the last showpiece events of the campaign — a BBC "Question Time" program — he was battered by hard-hitting questions from an audience selected to include supporters of all three parties, as well as undecided voters.

When asked if Labour had spent too much money during their previous tenure in office, Miliband said no. The audience gasped and tittered. He tried to explain that Labour built schools and hospitals, but the national mood of low trust in leadership was evident.

The irony is that group meetings are just the sort of thing he normally does well. Miliband has been having a charmed moment lately, winning praise for strong performances in a series of pre-election debates.

"He's come on leaps and bounds in terms of presentation in these final weeks," said Mark Ferguson, editor of LabourList, an independent political blog.

"Ed's real strengths come across when he speaks to 100-200 people — town hall comments," Ferguson said. "He engages with people. He doesn't pretend to have all the answers. He understands that over-promising and under-delivering is a big problem."

Those strengths were on show during an April 29 campaign event in London. The audience of Labour supporters wasn't likely to be hostile, and Miliband schmoozed his way through the crowd, working the room as if he were at a cocktail party.

Pointing to one man who was wearing the proper shade of Labour red, he said "Good choice of tie!"

When Brenda Jules, who publishes a business and lifestyle blog, mentioned that she had asked him a question about the National Health Service during a campaign stop earlier in the year, he quipped, "Did I give a good answer or not?"

Afterward she confessed Miliband still hadn't answered her question despite two attempts. But Jules, who describes herself as 50 plus, remains a devotee nonetheless.

"He's been underestimated," Jules said. "David Cameron is a handsome man. (Ed's) not the person you would grab and say you want a date with, but I'm an older person and I can tell you that you should never judge a book by its cover."

Appearances do count, though, when running for public office. Miliband has been savaged for his nasal twang, a goofy grin that draws comparisons to Wallace of the "Wallace & Gromit" animated series and for an ungainly attempt to eat a bacon sandwich that was immortalized on the Internet.

Miliband says he doesn't read the bad press and wants voters to focus on substance, not style. He also may be helped by the fact that Cameron, for all his communications skills, has found it hard to win over voters still struggling in the wake of the 2008 financial crisis.

"He's not (Bill) Clinton and he's not Blair, but he's not a disaster," Bale said. "It's not like he's facing an incredibly popular, charismatic opponent."