At the end of A Crown of Swords, Rand follows Sammael to Shadar Logoth to kill him. While he is there, he is helped by a mysterious stranger - this is Moridin. At one point, Mashadar reaches for them, and they balefire Mashadar at the same time, crossing the streams. This created some kind of bond between their souls. More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.