TEHRAN — Two players on Iran’s national soccer team were banned for life from playing for their country on Thursday after they participated in a match with their club team in Greece against an Israeli team, an Iranian governmental official said.

The players, Masoud Shojaei, 33, the captain of the national team, and Ehsan Haji Safi, 27, one of Iran’s most promising players, played for their Greek club team, Panionios, in a home game last week in Athens against Maccabi Tel Aviv from Israel.

“It is certain that Masoud Shojaei and Ehsan Haji Safi will never be invited to join the national football team because they violated the red line,” Mohammad Reza Davarzani, Iran’s deputy sports minister said Thursday on Iranian state television.

The Iranian government does not recognize the state of Israel, and has no official ties with the country. A longstanding rule by the country’s Islamic government prohibits Iranian athletes from competing against Israeli athletes in any contest or tournament, including the Olympics.

Critics in Iran say the ban on competing against Israel has hurt the development of Iranian athletes, forcing them to forfeit or pull out of competitions in which they might face Israeli athletes. But hard-liners in the republic insist that ideology trumps sports.

Last year, the Iranian Olympian Alireza Khojasteh withdrew from the judo competition at the Rio Games, citing “personal reasons. It is widely thought that he did so to avoid the possibility of facing an Israeli opponent.

It took Iranian officials more than a week to announce the suspension of the two soccer players, who both played the full 90 minutes in their team’s 0-1 defeat in the second leg of a home-and-away series in the UEFA Europa League third qualifying round. Iran’s Parliament, in a special meeting of the foreign policy committee on Sunday, had already denounced the two players.

“Agreeing to play in a game against athletes of a regime that has given humanity nothing other than occupation, murder, aggression and betrayal is disrespectful of the rights of thousands of martyrs and those displaced and affected by the occupying Zionist regime,” the spokesman for the committee, Hossein Naghavi-Hosseini, told the semiofficial Mehr news agency.

Iran’s national soccer team has been on a winning streak recently under its Portuguese coach, Carlos Queiroz. In June, Iran became the first team from Asia to qualify for the World Cup in Russia, defeating Uzbekistan 2-0. Mr. Shojaei played 70 minutes in that decisive game, while Mr. Haji Safi was an unused substitute watching the match from the bench.

Missing two key players a year before the World Cup tournament could undermine the team’s chances of advancing in Russia.

“This is ridiculous, there is no law against playing against Israelis, it’s a decision for every athlete to make him or herself,” said Moeen Farrokhi, 28, a supporter of Iran’s national team. “They weren’t even playing for Iran, but for their club that invested in them.”

In fact, neither Mr. Shojaei nor Mr. Haji Safi participated in their club’s first game against Maccabi in Israel, which the Greek club also lost, 1-0.

“I am wholeheartedly hoping for FIFA to deprive Iran from participating in the World Cup for banning Shojaei and Haji Safi,” said another Iranian soccer fan, Hushang Mirza, on Twitter, referring to soccer’s world governing body. FIFA has rules that forbid political interference in countries’ national teams. There was no immediate reaction from FIFA on the decision by Iran to ban the players.

“These two are good players,” said Peyman Rahbar, a well-known sportswriter for the Varzesh3 website in Iran. “They can be replaced, but that is not an ideal situation.” He did not want to comment on the political nature of the decision, saying only, “We have to see what FIFA will decide.

Mr. Shojaei also made headlines in June when he asked Iran’s president, Hassan Rouhani, to allow women into the stadium for the team’s games. Since the Islamic revolution in 1979, women have been barred from entering soccer stadiums because conservative Shiite Muslim clerics say such places are inappropriate for women.

After Iran’s victory over Uzbekistan in June in Tehran in front of 60,000 men, Mr. Shojaei said, “They should set a course that women are also allowed to come to stadiums in the future.”