BERLIN — A man suspected of being an Israeli spy involved in the killing of a Hamas leader in Dubai last January was released on bail by a German judge on Friday.

“He can return to Israel if he wants to,” said Rainer Wolf, the spokesman for the prosecutor’s office in Cologne.

The suspect, known as Uri Brodsky, was charged with acquiring a passport under false pretenses. The prosecutor’s office said that Mr. Brodsky applied for and received a German passport in Cologne in 2009.

Mr. Brodsky identified himself as Michael Bodenheimer and said his father was a victim of the Nazis. German law provides citizenship to descendants of families persecuted by the Nazis.

With the passport, Mr. Brodsky is believed to have traveled to Dubai and joined Israeli intelligence agents who assassinated Mahmoud al-Mabhouh, a senior Hamas official, in his hotel room.

The plot was quickly uncovered, and closed-circuit television images of the suspects disguised as tourists were widely published. The sloppy work embarrassed Israel, whose Mossad spy agency had been considered the world’s best, and angered several European countries who said that the suspects carried forged European passports.

Mr. Brodsky was arrested at the Warsaw airport in June by Polish authorities acting on a German warrant. Germany requested his extradition on charges of spying and passport fraud, but a Polish court ruled that he could not be extradited for espionage because spying against Germany is not a punishable crime in Poland.

Poland handed Mr. Brodsky over to the German police on Thursday on the forgery charge, meaning that Germany could charge him only with that crime.

That charge was issued in Cologne on Friday. The maximum fine would be covered by the bail, the prosecutor’s office said.