The 26-year-old, who had taken four bank employees hostage in the morning in the same area where serial killer Mohamed Merah lived and was shot dead by police in March, was wounded in the assault, police sources said.
The two other hostages, both women, had been released earlier, and no police officers were injured in the operation, which took place at 4:45 pm local time (1445 GMT), police said.
Police shot the man as he was trying to exit the bank holding one of the hostages and waving his gun. He was wounded and returned inside, where he was apprehended.
The gunman, identified as Fethi Boumaza, was wounded in the left hand and right thigh, local prosecutor Michel Valet said, adding that while his injuries were "significant", his life was not in danger.
The locations of the wounds "show that the police were looking to neutralise, to protect the hostages, and not for one second to kill" the suspect, he said.
Nearly seven hours earlier the man had entered the CIC bank, demanded money then fired a shot and taken the bank manager and other staff hostage, saying he wanted to negotiate with the elite RAID police unit that killed Merah.
Valet said the gunman had claimed to act based on his religious beliefs but had seemed confused.
"These were poorly defined and poorly expressed religious claims," he said. "We are dealing with someone who suffers from significant mental problems."
Police said the gunman had a criminal record and an informed source said he was schizophrenic and "may have stopped his treatment".
He was "put in a foster home when he was little and suffers from rage and fears the outside world," his sister told AFP over the telephone. She said he was not very religious, adding: "We went to nightclubs and drank alcohol."
He entered the bank at around 10:00 am and insistently asked for money but staff did not take him seriously, police told AFP. He then produced a gun and took everyone hostage.
Rapid-intervention GIPN police units were dispatched from southern cities Bordeaux and Marseille to tackle the hostage-taking.
President François Hollande hailed police for their handling of the incident, praising them for their "efficiency and self-control".
The CIC bank and Merah's former flat are within 500 metres of each other in Toulouse's Cote Pavee neighbourhood, east of the city centre.
Merah was killed at the end of a 32-hour siege of his flat after he shot dead seven people –three soldiers, and three children and a teacher at a Jewish school in Toulouse – in a wave of killings that shocked the country.
Toulouse, a city of around 500,000 people, lived in fear while police hunted the killer before he was identified as Merah. His neighbourhood has struggled to shake off the stigma of being associated with him.
"We're going through the same thing as three months ago," Maria Gonzalez, a mother with two children who could not go home because of the police cordon, said Wednesday before the incident was resolved.
"We used to be worry-free in the neighbourhood, but since the Mohamed Merah problem, we're worried. It's happening again, it's starting to scare me," she said.
Merah, 23, who claimed to be acting for Al-Qaeda, filmed himself carrying out his attacks and reportedly confessed to police before he was shot dead.
A petty criminal of Algerian origin, Merah reportedly spent time in Pakistan and Afghanistan but it is not known if he attended militant training camps.
Riding a powerful scooter, Merah shot dead three French troops in cold blood, reportedly because of French military interventions abroad.
He told negotiators the Jewish school killings were to avenge Palestinian children killed by Israel.
French intelligence was heavily criticised for failing to keep tabs on Merah despite the fact he travelled to known hotbeds of militant Islam.
France has the largest Muslim population in Europe.