KOMOTINI, Greece (Reuters) - Turkish President Tayyip Erdogan gave out toy cars and dolls to children on the final leg of a visit to Greece on Friday, a trip meant to boost ties but which has exposed the deep rifts between the two neighbors.

Slideshow ( 16 images )

Erdogan visited the Muslim community in Komotini, a town in northern Greece which once belonged to the Ottoman Empire. A day earlier, he riled his Greek hosts by suggesting the 130,000 Muslims in the region were discriminated against by Athens.

“We have made very important decisions to meet the needs of our ethnically Greek citizens, and it is our right to expect similar behavior from Greece,” he told cheering crowds outside a school in the region.

Turkey has frequently found fault with the appointment by Athens of local Muslim clerics - known as Muftis - instead of recognizing those elected by the local population.

Erdogan is the first Turkish president to visit Greece in 65 years, but he has put Athens on the defensive by remarking that a decades-old treaty needs revision. The treaty, among other things, defines the boundaries between the two countries.

None of that controversy was apparent on Friday, as hundreds of well-wishers gathered outside a mosque in Komotini to welcome Erdogan. Aides carried bags stuffed with toys, which Erdogan gave out to children.

Some supporters shouted “Leader” as he made his way through the crowds. Greek police snipers were stationed on nearby buildings and security was tight.

“Erdogan is very popular among the Muslim community in the area. He is an ordinary person close to the people,” said Ahmet Hoca, 57, a farmer.

Closer to Istanbul than to Athens, this community in northern Greece sometimes feels uneasy with the disputes between the two countries, which range from airspace in the Aegean Sea to minority rights.

“When someone asks you whom you love more, your mother or your father, what are you supposed to answer? You love them both,” said resident Hussein Kara, 64.

After World War One and the collapse of the Ottoman Empire, the 1923 Treaty of Lausanne pushed modern Turkey’s borders eastwards.

About 1.3 million ethnic Greeks, and 356,000 Turks, moved between Turkey and Greece in a population exchange. The deal excluded Muslim inhabitants of Western Thrace, which includes Komotini, and more than 200,000 Greeks then living in Istanbul.

Fewer than 3,000 ethnic Greeks now live in Istanbul.