Yahya related to me from Malik that he asked Ibn Shihab and Nafi, the mawla of Ibn Umar, whether a man who joined an imam who had already done a raka should say the tashahhud with the imam in the second and fourth rakas, even though these were odd for him? They said, "He should say tashahhud with him." Malik said, "That is the position with us."
عَنْ رَجُلٍ دَخَلَ مَعَ الإِمَامِ فِي الصَّلاَةِ وَقَدْ سَبَقَهُ الإِمَامُ بِرَكْعَةٍ أَيَتَشَهَّدُ مَعَهُ فِي الرَّكْعَتَيْنِ وَالأَرْبَعِ وَإِنْ كَانَ ذَلِكَ لَهُ وِتْرًا فَقَالاَ لِيَتَشَهَّدْ مَعَهُ قَالَ مَالِكٌ وَهُوَ الأَمْرُ عِنْدَنَا