The defendant, 31-year-old Mustufa Haidar Syed-Naqfi, was sentenced to four years and three months in prison "for working for a foreign intelligence service", a spokeswoman for Berlin's superior court said.
The court found he spied "against Germany and another NATO member", France, for the Quds Force, the foreign operations wing of the elite Revolutionary Guards.
Syed-Naqfi compiled dossiers on possible attack targets - a German lawmaker who is the former head of a German-Israeli organisation, and a French-Israeli economics professor.
Investigators found detailed dossiers on the men and their daily routines, with hundreds of photos and video clips.
The court heard they detailed the targets' homes and work places, various access routes to them, as well as information on security guards, surveillance cameras and nearby police stations.
A representative of Germany's domestic intelligence service, which handles counterespionage, said it was alerted to the defendant by a "reliable" source.
The service suspected the Quds Force was preparing for a possible future conflict with the United States and Israel, when it could hit targets in Europe in a form of "asymmetrical warfare".
The Karachi-born Syed-Naqfi came to Germany as a student in 2012 and most recently lived in the western city of Bremen.
The defendant travelled to Iran at least twice, in October 2015 and February 2016, and received at least 2,052 euros ($2,237) for his intelligence activities.
He was arrested in July 2016 but declined to testify during the trial - "out of fear", according to his lawyer.