<Li> Josh Radnor as Ted Mosby, an architect, college professor and the central character of the series . He is the main protagonist since he tells the story of his adult years from his late twenties to his early thirties and about all the obstacles he has to overcome before he meets "The One" aka the Mother . This story is told by the Older Ted Mosby, and narrator of the series, Bob Saget . Ted moved to New York City with his friends Marshall and Lily after graduating from Wesleyan University . In New York, he met Barney at the urinal of MacLaren's and Robin, to whom he was immediately attracted . Ted is on a quest for happiness and "The One", the woman he will marry . Ted prefers more elegant and high - class interests than his friends have . He goes to great lengths to profess his love to the women in his life, but they all falter eventually . Despite these qualities, Ted often acts immaturely, such as partaking in wild activities with Barney . In the show's finale, he says, that, in Tracy, he had met the love of his life (the titular Mother), but only after he was finished telling the story he realized that Robin was the love of his life . </Li> <Li> Jason Segel as Marshall Eriksen, Ted Mosby's best friend . In season 2 Marshall marries Lily, with whom he has been in love since his freshman year of college; they have a child during season 7 . Marshall was born in St. Cloud, Minnesota . He has an interest in the paranormal phenomenon, and mythical creatures, particularly Sasquatch . His dream to be an environmental lawyer, conflicts with his immediate need for money, such as for his wedding and to raise his children . </Li> <Li> Cobie Smulders as Robin Scherbatsky, a news anchor who has on - again - off - again relationships with both Ted and Barney . Robin emigrated from Canada to take a job in a news station and met Ted at MacLaren's; her Canadian background is a source of many jokes from her friends . She is shown to be very career - centric and rejects traditional roles, such as getting married and having kids . Robin often drinks scotch and smokes cigars, and she is an avid gun fan . She and Barney get engaged and later marry in the first part of the series finale, but divorce in the second part, three years later . Cobie's husband Taran Kilam has also appeared on 6 episodes of the show as Gary Blauman . </Li> <Li> Neil Patrick Harris as Barney Stinson is a serial playboy, using his relative wealth and an array of outrageous strategies to seduce women with no intention of engaging in a relationship . His catchphrases include' Suit Up' and' Legend - wait - for - it - Dary' . He is Ted's "bro," often jealous of Marshall for having known Ted since college and that Marshall is Ted's first best friend . Abandoned by his father at a young age, Barney has abandonment issues and clings to his friends . He marries Robin in the series finale but they divorce after three years . In 2020, a failed one - night stand gives him a daughter, Ellie . Neil's husband David Burtka has appeared on 7 episodes on the show as Scooter . </Li>

Who gets married at the end of how i met your mother