TEHRAN — An opposition leader long under house arrest has written a letter to President Hassan Rouhani demanding a public trial, putting the president in a difficult spot and highlighting a deepening rift in Iran’s reformist wing.

In the letter, published Sunday on a foreign-based Persian-language website, Saham News, the opposition leader, Mehdi Karroubi, does not ask the president to grant him his release, “since this is not in your power.”

Yet even asking for a trial presents a problem for Mr. Rouhani, a moderate who in the past has promised to end house arrest for Mr. Karroubi and two other leaders of the so-called Green Movement, Mir Hussein Moussavi and his wife, Zahra Raghnavard. Either he grants Mr. Karroubi’s request — risking confrontation with Iran’s supreme leader, Ayatollah Ali Khamenei, and his hard-line supporters — or he denies it and looks weak.

So Mr. Rouhani has chosen to ignore the letter and instead allow his infuriated supporters to respond to Mr. Karroubi.