Syria's President Bashar al-Assad delivered prayers for Islam's Eid al-Fitr holiday in Hama on Sunday in a rare trip outside Damascus and his first declared one to Hama since the war began.

The visit appeared to be the furthest he has travelled inside Syria since fighting started in 2011, a sign of growing confidence after army gains aided by Russian air strikes.

State television broadcast footage of Assad standing to pray in a large mosque in Hama behind its imam, with other clerics standing with him and a large crowd of worshippers.

State news agency SANA quoted the preacher as saying that Assad's presence in the city for Eid showed that victory and the return of security were only "a few steps" away.

Rebels seeking to oust Assad have reached to within a few kilometres of the northern city of Hama as recently as March, before the army and its allies pushed them back.

Last year, he delivered Eid prayers in Homs, about 40 km (25 miles) closer to Damascus. He has not visited Aleppo since the army drove out rebels in December in Assad's biggest victory of the war.