President Obama visited the Twin Cities amid all the fanfare and security that any presidential visit brings. Yet, there’s a chance that as an African-American, he might have had a hard time getting a cab in downtown Minneapolis at night. If he had ditched his security force and tried to hail a taxi, he might have been out of luck.

And even if a cab had stopped for him, it may have driven off if his destination was too close by or if he wanted to pay with a credit card. All of those things are illegal in Minneapolis. City ordinances say taxi drivers can’t refuse to pick up customers or deny rides due to payment method or the length of the ride.

But as a recent Star Tribune story pointed out, those violations happen all too frequently in Minneapolis. Enforcing current laws and improving them should be a priority for the city.

Most of the nearly 200 complaints against cabdrivers filed with the city between 2012 and 2014 concerned overcharging, failure to take credit cards or refusing to make short trips. Star Tribune reporters saw for themselves on a recent Saturday night that blacks were often turned down by cabdrivers in favor of white fares. The same reporters were turned down 17 times in less than an hour because they wanted to travel only about a mile and a half.

That brand of blatant racial profiling and violation of the law must stop. In addition to being illegal, it damages the city’s reputation and hurts downtown businesses and the taxi industry itself. With heightened awareness of the dangers of drunken driving, more bar and restaurant patrons are wisely looking for cab rides after having a few drinks. They should feel confident that they can get the transportation they need.

In the interest of self-preservation, taxi cab companies should do more to reign in or fire offending drivers. Allowing consistent violations of their own rules will drive potential customers to transportation alternatives. It’s also worth noting that civil rights organizations have filed lawsuits against cab companies for discrimination in other cities. Local companies should take steps to prevent losing costly suits.

Some drivers say the behavior is justified, arguing that driving a cab can be dangerous. They cite times when customers have been unruly or drunk, have threatened or injured them, or have jumped out of their cabs without paying. Still, there are better ways to acknowledge and protect drivers’ safety than overt discrimination based on assumptions about the potential passengers of a certain age or skin color.

In defense of the companies and drivers, a taxi company lobbyist said that the number of Minneapolis cabs has increased from 373 to 854 since the city lifted caps on licenses in 2006. He pointed out that the number of complaints has stayed about the same — about 120 per year, a tiny percentage of the hundreds of rides that occur daily in Minneapolis.

But even a relatively small number of such incidents can erode public trust in city cabs. That’s especially true as taxis become a more important part of the overall transportation network in the metro area and especially in the downtowns. Cities with reputations for good taxi service attract more convention business. Imagine how many out-of-towners will use cabs during this month’s All-Star Game festivities.

To address the violations, the city licensing department is conducting its own stings and investigating complaints. If the offense is verified, the driver receives a violation letter. A second offense brings a $200 fine, and subsequent violations double the fine.

Traditional cab service faces increased competition from ride-sharing firms such as Lyft and UberX, unregulated start-ups that are operating illegally in Minneapolis. That could soon change, however, if the city adopts a new ordinance that would allow the services to operate legally if they agree to some form of regulation.

Cab companies and ride-sharing services can all be part of a regulated, consumer-friendly transportation system in the Twin Cities, but only if individual drivers do their part by following the rules and treating passengers with respect.

As unofficial ambassadors for out-of-towners and as providers of a vital service for residents, cabbies serve an important role in Minneapolis. It’s a role some drivers obviously need to take more seriously.