Moroccan detectives said that the pair had been pursued as part of an investigation into a terror attack on an internet cafe in the city last month.
"One of the two was hit by bullets and died from his injuries while the other blew himself up just as police officers were in the process of arresting him," a police statement said, according to the AFP news agency.
The incident occurred in the poor el-Fida area of the city and security is reported to have led to a security clampdown and roadblocks in the area.
According to police, the men were suspected of being involved in the March 11th attack which led to the death of a suspected suicide bomber. Three people in the cafe were also injured.
About 40 people have already been arrested as part of investigations into the attack.
Click here to run an energy price comparison, and see if you could be paying less for your gas and electricity.