Just days before he was shot and killed Sunday morning, a Baton Rouge police officer posted an emotional Facebook message saying he was "physically and emotionally" tired and expressing how difficult it was to be both a police officer and a black man, a friend said Sunday.

"I swear to God I love this city but I wonder if this city loves me," Montrell Jackson wrote.

He said while in uniform he gets nasty looks and out of uniform some consider him a threat.

"I've experienced so much in my short life and these last 3 days have tested me to the core," the posting read.

The message was posted July 8, just three days after a black man was shot and killed by police in Baton Rouge. That shooting was the beginning of an extremely tense week in the country's fraught history of race relations. Another black man was shot and killed by police the next day in Minnesota, with his girlfriend livestreaming the aftermath on Facebook. Then a black gunman opened fire during a protest against the police shootings in Dallas, killing five police officers.

Jackson does not specifically refer to those events but the posting appears to be a reaction to them.

Erika Green told The Associated Press Sunday that she is friends with the family of Jackson, one of three Baton Rouge law enforcement officers who were killed Sunday morning. She said she saw the message on his Facebook page.

In the message, Jackson says he is physically and emotionally tired.

"These are trying times. Please don't let hate infect your heart," Jackson wrote.

A screenshot of the image has been widely circulating on the internet but is no longer on Jackson's Facebook page.

State Rep. Ted James, who confirmed to the AP that Jackson was killed Sunday, said he had a 4-month-old child.