WASHINGTON — President Obama late Thursday night called Kamala Harris, the California attorney general, and apologized to her for telling a group of wealthy donors that she is the “best-looking attorney general in the country.”

Mr. Obama made the comment on Thursday morning at a fund-raiser outside San Francisco. He praised Ms. Harris as being “brilliant,” adding, “she is dedicated and she is tough” before commenting on her looks.

There was a quick reaction on social media sites, with some people accusing Mr. Obama of being sexist and others defending his comment as harmless.