All the hostages were safely released on Saturday night and the gunman was dead, Colleyville Police Chief Michael Miller told a news conference.
The gunman had initially taken four people hostage, including the rabbi, at the Congregation Beth Israel, officials said. One hostage was released unharmed six hours later.
Reporters said they heard the sound of explosions, possibly flashbangs, and the sound of gunfire shortly before Texas Governor Greg Abbott announced the crisis was over.
"Prayers answered. All hostages are out alive and safe," Abbott said on Twitter. The FBI said they have confirmed the identity of the gunman but said they would not yet disclose it. The FBI declined to confirm the cause of his death, saying it was still under investigation.
Britain's foreign office confirmed the death of a British man in Texas, when asked to respond to a Sky News report that the gunman was a British national. The foreign office did not explicitly say the dead Briton was the gunman.
The Colleyville Police Department said it first responded to the synagogue with SWAT teams in response to emergency calls beginning at about 10:41 a.m. during the Shabbat service, which was being broadcast online. FBI negotiators soon opened contact with the man, who said he wanted to speak to a woman held in a federal prison.
No injuries were reported among the hostages.
In the first few hours, the man could be heard having a one-sided conversation in what appeared to be a phone call during a Facebook livestream of the service of the Reform Jewish synagogue in Colleyville, which is about 16 miles (26 kms) northeast of Fort Worth. The livestream cut off around 3 p.m. EST (2000 GMT).
Before the livestream was ended, the man could be heard ranting and talking about religion and his sister, the Fort Worth Star-Telegram reported. The man could be heard repeatedly saying he did not want to see anyone hurt and that he believed he was going to die, the newspaper said.
President Joe Biden, who was briefed on the crisis as it unfolded, praised the "courageous work" of state, local and federal law enforcement in freeing the hostages.
"There is more we will learn in the days ahead about the motivations of the hostage taker. But let me be clear to anyone who intends to spread hate -- we will stand against anti-Semitism and against the rise of extremism in this country," he said in a statement.
Israeli Prime Minister Naftali Bennett said https://twitter.com/naftalibennett/status/1482463339385171970?s=20 he was praying for the safety of the hostages.
Barry Klompus, a member of the congregation since it opened in 1999, said he tuned into the livestream.
"It was horrible listening and watching," Klompus said in a telephone interview.
A U.S. official briefed on the matter told ABC News the hostage-taker had claimed to be the brother of Pakistani neuroscientist Aafia Siddiqui, who is serving an 86-year U.S. prison sentence for her 2010 conviction for shooting at soldiers and FBI agents, and that he demanded she be freed.
Siddiqui is being held at a federal prison in the Fort Worth area. A lawyer representing Siddiqui, Marwa Elbially, told CNN in a statement the man was not Siddiqui's brother. He implored the man to release the hostages, saying Siddiqui's family condemned his "heinous" actions.
The Council on American-Islamic Relations (CAIR), a U.S. Muslim advocacy group, condemned the man's actions.
"This latest antisemitic attack on Jewish Americans worshipping at a synagogue is an act of pure evil," CAIR said in a statement.
Klompus said he did not know of any significant previous threats to the congregation.
"We don't have a security officer on staff but we have what I would say is a very good relationship with the local police," he said.
(Reporting by Shelby Tauber in Colleyville, Texas, and Aram Roston, Daphne Psaledakis, Jonathan Allen and Valerie Volcovici; Additional reporting by Andrea Shalal and Marice Richter and William James; Editing by Jonathan Oatis, Leslie Adler, Tom Hogue and Emelia Sithole-Matarise)
By Shelby Tauber and Daphne Psaledakis