(Releads with loan deals, investment agreements, adds background)

CAIRO, Jan 21 (Reuters) - China signed a raft of economic deals with Egypt during a visit by President Xi Jinping on Thursday, including $1.7 billion in loans to the banking sector, and said it supports Egypt's efforts to maintain stability and set its own course.

Xi arrived in Egypt on Wednesday, the second leg of a Middle East tour, just ahead of the Jan. 25 anniversary of the 2011 uprising that ended autocrat Hosni Mubarak's 30-year rule.

Meeting Egyptian President Abdel Fattah al-Sisi -- who last month warned critics not to hold protests to mark the anniversary -- Xi said China and Egypt had developed a deep friendship based on mutual respect.

"What path a country or people chooses cannot be separated from historical and cultural traditions or the reality of economic development and should be set and orderly advanced by the country or people themselves," Xi said, according to China's foreign ministry.

"China supports Egypt's efforts to maintain stability, develop the economy and improve livelihoods, and supports Egypt to play an even greater role in international and regional affairs."

Heralding an era of closer political and economic ties, officials from the two countries signed 21 deals at a ceremony in Cairo that could see China significantly ramp up investments in the most populous Arab country.

The deals span several infrastructure investments, from power generation to the first phase of a new Egyptian administrative capital unveiled last year.

They also include a $1 billion financing agreement for Egypt's central bank and a $700 million loan to state-owned National Bank of Egypt.

Egypt has been battling to restore growth since the 2011 uprising ushered in a period of political instability that scared off tourists and foreign investors, key earners of foreign currency.

China's $1 billion loan could help bolster the central bank's foreign reserves, which have more than halved since 2011 as it battles to defend the currency against downward pressure.

Mindful that economic discontent helped unseat two presidents in the last five years, Egyptian security forces have arrested several activists and shut down cultural spaces in recent weeks to prevent protests as the anniversary approaches. Government-appointed clerics have meanwhile preached against public dissent.

Xi arrived in Egypt from Saudi Arabia and will head next to Iran.

While Xi was in Riyadh, China signalled its support for Yemen's government, which is fighting an Iran-allied militia, and repeated a call for a peaceful settlement in Syria.

China relies on the region for oil but has tended to leave Middle Eastern diplomacy to the other four permanent members of the U.N. Security Council -- the United States, Britain, France and Russia.

It has been trying to get more involved, especially in Syria, however, and recently hosted Syria's foreign minister and opposition officials.

(Reporting by Ali Abdelaty and Lin Noueihed in Cairo and Ben Blanchard in Beijing; Editing by Paul Tait and Catherine Evans) ((ben.blanchard@thomsonreuters.com; +86 10 6627 1201; Reuters Messaging: ben.blanchard.thomsonreuters.com@reuters.net))