It wasn't any old speech. "I want you to know that we have very much in common," she told the girls, at times coming close to tears. "There was nothing in my story that would land me here. I wasn't raised with wealth or resources of any social standing to speak of." She was in a different country, a foreign culture, miles from home, among people more than three decades her junior. Yet she saw herself in the girls, at a school that Ofsted has classed as "outstanding" despite being one of the 2% most deprived in the country; where 55 languages are spoken, 92% of pupils are black or from ethnic minorities, and 20% are the children of refugees or asylum seekers.

"Her staff have always told me that the girls had a profound effect on her," said Jo Dibb, the headteacher. "I do believe that she was really moved. And that she does feel an affinity with the girls."

Last week, the first lady was back. Despite a hectic state-visit schedule, she travelled to Oxford to meet 37 pupils from the all-girls school. In the hall of Christ Church, one of Oxford's grandest colleges, she made another moving speech: "From the minute I walked through the door," she told them, of the visit two years ago, "I knew that I had come to a very special place. I was blown away by your talent and felt this strong sense of connection. In your stories, I saw so much of my story."

At 12, Sufia Yahiya was one of the youngest of the group, and was chosen to walk with Michelle Obama when she left the building. At the time, she was too shocked to speak: "I just couldn't! I was just so overwhelmed," she said She shakes her head and shows me a picture of herself from a newspaper: small, headscarfed and bespectacled, walking hand in hand with the wife of the world's most powerful man towering above her. Sufia said that, during Michelle Obama's speech, "some people said that we looked bored – but that was because we were concentrating so hard. We were just trying to absorb every word. We just wanted to get every little thing we could out of it."

Listening to the girls two days later is almost more moving than watching the event. Michelle Obama's mission was to prove to them to that they were good enough; that they should aim higher. "It's important that you know this. All of us believe that you belong here," she said, gesturing at the medieval stonework. "We passionately believe that you have the talent, the drive, the experience to succeed here."

They were just words. But they worked. Stacia-Ellis Cummings-Mbachy, 13, was in no doubt: "Every person that came to speak to me, I said the same thing. Me and my friend, Sophia, we were like, 'No. We're coming here.' There's no doubt in my mind. I don't care what anyone says. I'm going to go to Oxford University."

But was she prepared for the hard work to get in? "I'm going to work really hard. Believe me. I am going to work so hard," she said.

As a lesson in how to empower and inspire girls and young women, the visit was a masterclass. Yet, it also felt personal, and emotionally charged. "What she said… she wasn't saying it just because she could," said Stacia-Ellis. "She was saying it because she meant it. And when she hugged us – she gave us all, every one, a hug at the end – you could feel it wasn't one of them fake hugs. It was a proper feeling hug. It was like being hugged by your mum." Obama said that people had queried her own decision to aim for the top: "I remember how well-meaning but misguided people sometimes questioned whether someone from my background should go to an elite university," she said.

"I worried that I wouldn't be as well prepared. That I wouldn't fit in." But she overcame her background, and achieved it through education – a lesson that all 37 girls have taken to heart. Ashleigh Jones, 15, explained: "What she said literally relates to everyone in this school.

"She didn't come from the best of backgrounds. She got put down. But she showed that your background doesn't determine your future. Hard work determines your future. I think that's what everyone needs to know. Just because you live on a council estate and have one parent, that's not going to determine your future."

Ashleigh is bright, articulate and determined, and does live on a council estate in a single-parent family. "My dad passed away, and now it's just me and my mum," she said. In an age of public spending cuts and austerity, she's a beacon of shining hope, but the spectre of tuition fees is already an issue for them. From next year, Oxford will be charging £9,000 a year, and that's before living expenses. To go there, Ashleigh would need to borrow an amount close to her mother's annual income as a teaching assistant.

Sophie Edge, 13, said: "It's something that you do think about. It's making some people less confident. They're thinking: if I can't afford it, how am I going to do it." Sophia Thompson, also 13, said: "Everyone says you can claim sort of benefits, but I wouldn't want to do that. That's how people from our kind of background are always stereotyped."

It's a stereotype that Dibb is well aware of. The school is a brilliant example of what an inner city institution can achiever. Former pupils have gained success at the highest levels, including Oxford. Michelle Obama met one of them, Clarissa Pabi, a published poet studying at the university. But Dibb is continually frustrated that "people living a stone's throw from" her school, such as in the million-pound-plus houses of Barnsbury a few streets away, send their children elsewhere. "It's such a diverse borough, and we want to represent the whole community, but we don't." She said that it was a source of puzzlement and frustration, as well as enormous pride, that Michelle Obama had "bought into the ethos of this school", where difference is embraced and celebrated, and yet the middle classes of Islington so far, had not. And for all the talk at Oxford on Wednesday, and the visible efforts the university makes to woo those, such as the EGA girls, the institution still manifestly fails to increase student diversity. Despite years of access schemes, state school applicants still make up less than 55% of its students. And while Clarissa Pabi's experience inspired many EGA girls, she remains an exception, not least because she is black.

You would be forgiven for not expecting the girls to be aware of a speech that David Cameron made last month, in which he said: "I saw figures the other day that showed that one black person went to Oxford last year. I think that's disgraceful." (The university fought back saying this was "inaccurate and highly misleading". It was one black Caribbean candidate out of a total of 27 black students accepted.) But Sophia was aware of it, and had a clear view: "He got his facts wrong, but just a little bit. Obviously, [the figures are] very poor. But at the end of the day, it's your attitude to learning. A lot of people will say 'Oh I can't go here.' But it's not going to worry me until someone comes up to me and says you're not allowed because of the colour of your skin."

These girls, inspired by Michelle Obama, and their teachers ("The skin colour thing is like our school," says Sophie. "Like all our buildings are broken and falling down but it's what's inside that matters") believe that anything is possible. They've made the great imaginative leap forward: they can see a future where hard work is rewarded, and worth is measured according to merit. It's the rest of the education system that's lagging behind.

In every way it is possible to measure, social mobility in Britain is in reverse. And education – and the way that society values it – is the cornerstone of this. Jo Dibb said that she was one of the "lucky generation". She didn't have to pay for her university education "unlike everyone who came before me, and everyone after me". And, in spite of everything, she, like Michelle Obama, like her students, still believes in the dream. "Every day, every single member of staff chooses to work here because we think we can make a difference," she said.

Or as Ashleigh put it: "If you've got the brains and the confidence you can do whatever you want."

Obama proved it to them. Now Oxford, Cambridge, and the rest of the Russell Group universities needs to do the same.

"She made it," said Sophie. "And so can we. That's not just something we've heard now. We really actually felt it."