This Article Contains Spoilers - WARNING: This article contains major spoilers. If you do not wish to know vital information on plot / character elements in a story, you may not wish to read beyond this warning: We hold no responsibility for any negative effects these facts may have on your enjoyment of said media should you continue. That is all.
Loghain Mac Tir was originally a farmer's son who befriended Prince Maric Theirin and aided him in his rebellion against the Orlesian occupation of Ferelden. At one point the two encounter Flemeth, who warns Maric he will not live to see the next Blight and that Loghain will betray him. Loghain acted as Maric's commander and won a decisive victory in the Battle of River Dane, becoming known as the Hero of River Dane. When Maric regained the throne he made Loghain a Teyrn and arranged for his son Cailan to marry Loghain's daughter Anora.
In the early Dragon Age, Maric offers to accompany a group of Orlesian Grey Wardens into the Deep Roads to help them navigate the tunnels. Maric ends up being betrayed by the some of the Wardens as well as their Orlesian allies as part of a scheme to invade Ferelden again, which Loghain helps stop. Even so, Maric ends the centuries long exile of the Ferelden Grey Wardens. Loghain also is one of the only people who know Maric fathered a bastard, Alistair, with one of the Grey Wardens. After Maric's disappearance, Cailan takes the throne and marries Anora.
Dragon Age: Origins
After a number of battles with smaller hordes of darkspawn, King Cailan requests the help of both the Ferelden and Orlesian Grey Wardens, the former who warn him and Loghain it is the beginning of a Blight. Loghain refuses to believe it, likely due to his mistrust of the Wardens and the fact that a Blight would indicate Maric was definitely dead. In preparing for the battle at Ostagar, Cailan wishes to wait for Orlesian reinforcements, both Wardens and chevaliers, but Loghain convinces him not to. During the battle, the darkspawn horde is significantly larger than anticipated and when the signal is lit for Loghain to enter the fray with his army, he decides it's fruitless and abandons the king and Grey Wardens. Despite the suspicions of some of the nobles, Loghain claims the Grey Wardens are at fault for the failure at Ostagar and puts a bounty on their heads.
As the Wardens travel around Ferelden on their quest to gather enough armies for the Blight and expose Loghain, many of the villains and hardships they encounter are in some way caused by Loghain or someone supporting him. He has hired assassins to kill the Grey Wardens, allowed Arl Howe to torture innocent people in his dungeon, and enabled slavers to kidnap elves in the Denerim Alienage. He has also made questionably competent attempts to get the Circle of Magi and the dwarves of Orzammar on his side, the latter of which backfired and the former of which backfired spectacularly. Meanwhile, Anora starts becoming disillusioned with her father, worried about his role in Cailan's death and mounting extremism.
Towards the end of the game, a “Landsmeet” is called between Loghain and those in support of the Wardens and Cailan's uncles. A public debate is staged in which Loghain defends his actions by saying it was the king’s fault for getting himself killed by directly commanding his troops from the front lines, partly spurred on by his naive belief in the heroic tales of the Grey Wardens’ wars against the Darkspawn. Loghain claims he was forced to allow these atrocities for the sake of the war effort in order to avoid being destroyed by the Darkspawn. He campaigns for his daughter to remain queen, but if the Wardens promise her their support for the throne, Anora will turn against him.
Regardless of who wins the Landsmeet, It is decided that Loghain and a champion representing the Wardens should have a duel to decide the issue, and the Warden or any of their companions may fight him. Loghain surrenders and the Warden can choose to execute him. As an alternative, the Grey Warden Riordan will suggest the Warden spare Loghain with the option of becoming a Grey Warden himself. Choosing this option outrages Alistair and causes him to depart the Warden's company before the final battle. Loghain is put through the “Joining” ritual to become a Grey Warden and survives, joining the Warden's party in Alistair's place.
When it is explained that the Archdemon Urthemiel can ‘’only’’ be killed by a Grey Warden, and that the Grey Warden in question dies afterwards, Morrigan offers to avoid this by way of a blood magic ritual. It entails having sex with a male Grey Warden (this can be either Loghain or a male Hero of Ferelden) which will impregnate her and produce a baby who will absorb the Old God soul of the Archdemon. If this offer is declined and Loghain is the one to deliver the final blow to the Archdemon, he will die.
If Loghain is a Grey Warden but does not die in the final battle, he is later reassigned to the neighboring country of Orlais. Given that he was to a large degree responsible for Ferelden's successful rebellion against Orlais, he is not optimistic about his reception there.
Dragon Age: Inquisition
The Grey Wardens have been tricked by the Nightmare Demon that serves Corypheus into believing that the effects of the Joining will soon kill them, and most have gotten behind Livius Erimond and Clarel de Chanson's efforts to destroy the two remaining potential Archdemons before they can rise. If Loghain is alive and a Grey Warden, he speaks out agains this plan, having seen where rationalizations of the greater good can lead. For this he is chased from the Order and has to flee assassination attempts. He eventually attempts to stop the plan with the aid of the Inquisition and the Champion of Kirkwall, but in the battle that ensues he, Hawke, the Inquisitor and their companions are thrown into the area of the Fade ruled by the Nightmare Demon. While the rest of the party is escaping, Hawke and Loghain both offer to be left in the Fade to distract the demon and whoever is left behind is presumed dead.
If Loghain isn't left in the Fade, he is the senior member of Grey Wardens in both Ferelden and Orlais and depending on whether or not the Inquisitor allies or banishes the Wardens, he either leads them into exile at Weisshaupt Fortress or leaves them to serve the Inquisitor while he tells the Wardens at Weisshaupt what happened.