Iran did offer sanctuary to Osama Bin Laden’s family after 9/11/01, FWIW. They weren’t involved in the attacks per se, but they were accomplices after the fact.
Iran helped us in Afghanistan against the Taliban and their terrorist allies in the early years of the Afghan war. It’s a shame that unwise rhetoric promoted by some in the Bush administration led to a break from our natural Iranian allies in the war against Taliban terror.