PARIS — Salah Abdeslam, who is believed to be the only surviving member of the group that carried out a series of coordinated attacks in and around Paris in 2015 and then in Brussels five months later, was convicted on Monday and sentenced to 20 years in prison for shooting at the police in the Belgian capital while he was on the run.

The Brussels Criminal Court also convicted Sofien Ayari, who was with Mr. Abdeslam at the time of the fusillade and sentenced him to the same 20-year term that prosecutors had sought for both men.

Mr. Abdeslam, 28, who has French citizenship, and Mr. Ayari, who is Tunisian, faced trial on charges that included possession of illegal weapons and attempted murder in a terrorist context.

The two men were accused of shooting and wounding four Belgian and French police officers who were searching for them in southern Brussels, four months after the attacks in Paris and the northern suburb of St.-Denis that left 130 dead, and days before two deadly attacks in Brussels, one at the main airport and another on a subway train.