President Obama condemned the shooting of two police officers during protests in Ferguson, Mo., saying that though the city's law enforcement practices were "oppressive and objectionable", there was "no excuse" for violence. 

Obama made the remarks during a taped appearance on ABC's "Jimmy Kimmel Live" Thursday evening. 

The officers were shot just after midnight Thursday morning as protests were winding down following the resignation of Ferguson Police Chief Tom Jackson. Jackson was the sixth city official to leave office following a Justice Department review of the city's law enforcement practices. The review was precipitated by the fatal shooting last August of Michael Brown, an 18-year-old black man, by a white police officer, Darren Wilson.

The officers were treated for their injuries and released from a St. Louis hospital Thursday morning.

"Whoever fired those shots should not detract from the issue -- they are criminals, they need to be arrested," Obama said. "And then what we need to do is make sure that like-minded, good-spirited people on both sides -- law enforcement, who have a terrifically tough job, and people who understandably don't want to be stopped and harassed just because of their race -- that they are able to work together to come up with some good answers."

Earlier Thursday, Obama had tweeted about the shooting, calling it "unacceptable."

 

Obama's Ferguson remarks were a rare detour into seriousness by the president during his "Kimmel" appearance. The president also submitted himself to one of the show's most popular segments, "Mean Tweets," in which celebrities are forced to read hostile Twitter comments about themselves.

After enduring the routine, Obama told Kimmel, "You should see what the Senate says about me."

The president also joked about the perks and restrictions he faces, revealing that he's not allowed to use cellphones that have recorders in them. (Hence his ever-present BlackBerry.) He also noted that he can visit the dentist in the White House basement but doesn't text and can't drive.

Kimmel asked if that was because you have to have a birth certificate to get a driver's license.

Obama -- whom Kimmel introduced as the "first Kenyan-born Muslim Socialist ever elected president" -- deadpanned that Kenyans "drive on the other side" of the road.

With fellow guest Sean Penn waiting in the wings, Obama said he was quite familiar with Penn's 1982 coming-of-age comedy "Fast Times at Ridgemont High."

"I lived it," Obama said. "I didn't just see it."

Later Thursday, Obama attended a Democratic National Committee fundraiser at the Santa Monica home of Chris Silbermann, president of ICM Partners, one of the top talent agencies in Hollywood. The event was closed to the press, but a Democratic official said the event attracted about 25 people who each paid up to $33,400.

On Friday, Obama is flying to Phoenix to hold a roundtable event on veterans' health care.

The Associated Press contributed to this report.