The Mahdi is someone who will help the muslims, there is a narration recorded in Abi Dawud which mentions that every century there will be someone who will revive Islaam for the muslims [known as a Mujaddid.] These people don't bring anything new into the religion, they just call back to it [the teachings of Qur'an and Authentic Sunnah.] The scholars agree that Umar ibn Abdul Aziz (who ruled with total justice etc.) and he was the first reviver on the first century of Hijrah. And there were others as time has progressed.
The Mahdi will also be a Mujaddid and he won't bring any new message, nor will he be a prophet of Allaah. But he has been prophecised by the Messenger of Allaah (peace be upon him) also - & he will also revive Islaam and remove injustice on the earth the same way it was spread with injustice before. He will come at a time when the final hour will be drawing near, we know that this is the case because the final hour is closely approaching - because many other prophecies related to the closeness of the final hour are already taking place today.
Maybe you'd like to check this thread out for more info related to that:
http://www.islamicboard.com/akhira-hereafter/3428-signs-before-day-judgement.html
If you're confused about the Messiah - Jesus son of Mary (peace be upon them) returning to the earth, he will also come as a follower and apply the law which was revealed to Allaah's final Messenger, Muhammad (peace be upon him.) Since we know that he wasn't killed, rather he was raised to the heavens by Allaah for a temporary amount of time, until Allaah wills for him to return. He will be the leader of the muslims while the Mahdi is still alive.
Since the Mahdi won't be able to kill the anti-christ, it will be Jesus son of Mary himself who will kill the christ.
"Ibn Mas'ood reported that the Prophet (peace be upon him) said, "On the night of the Israa' (night journey), I met my father Abraham, Moses and Jesus, and they discussed the Hour. The matter was referred first to Abraham, then to Moses, and both said, 'I have no knowledge of it'. Then it was referred to Jesus, who said, 'No one knows about its timing except Allah; what my Lord told me was that the Dajjaal [the anti-christ] will appear, and when he sees me he will begin to melt like lead. Allah will destroy him when he sees me. The Muslims will fight against the disbelievers, and even the trees and rocks will say, "O Muslim, there is a disbeliever hiding beneath me - come and kill him!" Allah will destroy the disbelievers, and the people will return to their lands. Then Gog and Magog will appear from all directions, eating and drinking everything they found. The people will complain to me, so I will pray to Allah and He will destroy them, so that the earth will be filled with their stench. Allah will send rain which will wash their bodies into the sea. My Lord has told me that when that happens, the HOUR WILL BE VERY CLOSE, LIKE A PREGNANT WOMAN WHOSE TIME IS DUE, BUT HER FAMILY DO NOT KNOW EXACTLY WHEN SHE WILL DELIVER."
[Recorded in Ahmad, Musnad, 1/375. Similar Hadith in Ibn Maajah, Kitaab al-Fitan (hadith 4081), 2/1365, 1366]
The fighting is between the believers and the followers of the anti-christ, and Allaah knows best.
So the Messiah son of Mary will come back and fight the anti-christ while the Mahdi is among the believers, and Jesus son of Mary will be the leader of the believers. He will clarify to the people that there is none worthy of worship except God Alone, and that he is the servant and Messiah of God. He will break the cross. The world will be filled with believers, and he will be a just ruler.
And Allaah Almighty knows best.
Regards.