He was wrong in adding the fourth Rakah and he should have sit immediately as the extra third Rakah was invalid!

One of my friends is Hafiz and leads Traveh prayer. During Traveh his intention was two rakah but he forgot and got up for third raka. No body behind him pointed out mistake. He realized it at third raka and then completed the forth raka also. After he concluded the prayer with sajda sahv. Will it be considered two raka or four raka? Please clarify?

Prayer |