Turkish President Tayyip Erdogan said Egypt should free ousted Islamist president Mohamed Mursi from jail and lift death sentences against his supporters before Ankara could consider an improvement in relations with Cairo.
Ties between the two former allies have been strained since then Egyptian army chief Abdel Fattah al-Sisi toppled elected President Mursi of the Muslim Brotherhood in 2013 after mass protests against his rule.
Egyptian security forces then mounted one of the fiercest crackdowns against the Islamist movement, killings hundreds of supporters at a Cairo protest camp, arresting thousands and putting Mursi and other leaders on trial.
"Mr Mursi is a president elected by 52 percent of the votes. They should give him his freedom," Erdogan was quoted by Turkish newspapers as telling reporters travelling on his plane as he returned from an official visit to Iran.
An official from Erdogan's office confirmed his comments.
Mursi's Muslim Brotherhood has close ties with Turkey's ruling AK Party, which Erdogan co-founded and which has emerged as one of the fiercest international critics of Mursi's removal, calling it an "unacceptable coup" by the army.
Erdogan's recent visit to Saudi Arabia, and his support of a Saudi-led military operation against Houthi rebels in Yemen in which Egyptian warships have taken part, have triggered speculation about a possible thaw in ties between Ankara and Cairo.
Erdogan had more conditions before that could happen, and reiterated his criticism of Western countries for not being more vocal about Egypt's treatment of political prisoners.
"Secondly, doesn't the West say it is against the death sentence? There are 3,000 people there sentenced to death. This should be lifted," Erdogan said, when he was asked if there was any chance of rapprochement in relations with Cairo.
Egyptian courts have sentenced hundreds of alleged Brotherhood supporters to death in recent months, many in mass trials condemned by foreign governments and rights groups as violating international law.
Erdogan said there were around 18,000 political prisoners who should be retried and bans on political parties in Egypt, which he says are arbitrary, should be removed.
"They say 'Turkey should not interfere with our domestic affairs'. We are not interfering. If something happens in a country against freedoms, we should speak up," Erdogan said.
Egypt has complained about previous comments made by Erdogan against Sisi and rejected Turkey's criticism of the government.