"In the country there are different political views... Do not deprive someone of security if he does not seek regime change or betrayal, or does not want to carry out enemy orders, but does not share your view," said Ayatollah Ali Khamenei.
"Piety is not trampling on one's opponents," the all-powerful leader told hundreds of thousands of people gathered in and around the shrine.
Khamenei also backed the government of Mahmoud Ahmadinejad, following weeks of criticism by ultra-conservatives of those close to the hardline president.
"The administration has been able to accomplish many great tasks, construct major infrastructure works... which the people will see the outcome of these tasks in near future," he said.
The conservative camp has accused Ahmadinejad's chief of staff and closest confidant Esfandiar, Rahim Mashaie, of leading a "deviant current" seeking to undermine the foundations the Islamic republic.
The attacks surfaced as the president's camp announced its intention to draw up its own candidates in parliamentary elections set for March 2012 to compete against the current ultra-conservative majority close to Khamenei.
Khamenei reiterated an appeal he made last week to his followers to cease their attacks against the government, but that failed to halt the political infighting.
Long considered to be the mentor of Ahmadinejad, Ayatollah Mohammad Taqi Mesbah Yazdi, slammed Mashaie on Thursday without naming him, according to the local media.
"Unfortunately they have acted diabolically and have influenced some figures (referring to Ahmadinejad) ... but this trash cannot do anything," the cleric was quoted as saying.
During a speech Friday at Khomeini's shrine, Ahmadinejad reiterated his loyalty to Khamenei, indirectly rejecting criticism of his opponents who accuse him of straying from the path of the supreme leader.
Khamenei, who has the final say in the Islamic republic's macro politics, including in foreign affairs, also talked about the Palestinian issue.
"We believe that the country of Palestine belongs in its entirety to the Palestinians. Palestine is inseparable and it belongs to the Palestinians undivided," said Khamenei.
"Palestine will return to the arms of Islam, without any doubt."
Iran has not recognised Israel since the 1979 Islamic revolution and backs Palestinian and Lebanese militant groups fighting against the Jewish state.
It also does not support the creation of a Palestinian nation alongside the Jewish state.
US President Barack Obama said in a speech in mid-May that the borders of Israel and Palestine "should be based on the 1967 lines with mutually agreed swaps, so that secure and recognised borders are established for both states."
Palestinian president Mahmud Abbas has threatened to seek UN recognition as a full member country for the territories under his jurisdiction in September if peace talks do not resume.
Iranian officials repeatedly said that Tehran's regional archfoe is doomed to perish.