WASHINGTON — The United States built Twitter-like social media programs in Afghanistan and Pakistan, like one in Cuba, that were aimed at encouraging open political discussion, Obama administration officials said Friday. But like the program in Cuba, which was widely ridiculed when it became public this month, the services in Pakistan and Afghanistan shut down after they ran out of money because the administration could not make them self-sustaining.

In all three cases, American officials appeared to lack a long-term strategy for the programs beyond providing money to start them.

Administration officials also said Friday that there had been similar programs in dozens of other countries, including a Yes Youth Can project in Kenya that was still active. Officials also said they had plans to start projects in Nigeria and Zimbabwe. Some programs operate openly with the knowledge of foreign governments, but others have not been publicly disclosed.

The Kenya project, like the Cuba program, is the work of the United States Agency for International Development. The projects in Afghanistan and Pakistan were run by the State Department. All such programs have come under greater scrutiny since the administration acknowledged the existence of the Twitter-like program in Cuba, which ran from 2008 to 2012, when it abruptly ended, apparently because a $1.3 million contract to start up the messaging system ran out of money.