SANTA CLARA — San Francisco 49ers coach Jim Harbaugh delivered a simple but emphatic message to his players as they gathered in a circle at the end of the team’s three-day minicamp.

Following an offseason in which three key players were either arrested or were part of an investigation by police, Harbaugh warned the 49ers to be more aware of their circumstances and who they hang out with.

Quarterback Colin Kaepernick was one of the three players involved in off-field incidents.

Although Kaepernick was never charged and was cleared of any wrongdoing stemming from a possible sexual assault investigation in Miami, he said the incident left him more cautious about his life away from football.

“A lot more,” Kaepernick said Thursday. “Since I really started playing it’s something I’ve been more aware of, especially in the past few months. It’s something that obviously you have to be very aware of.”

Kaepernick and two other NFL players were investigated for an incident involving a woman at a downtown hotel in Miami in April. Kaepernick repeatedly denied that he had done anything wrong, and prosecutors decided earlier this week to drop the case and not charge any of the three players.

Later, 49ers linebacker Aldon Smith was arrested at Los Angeles International Airport after authorities said he became belligerent during a security screening and threatened that he had a bomb.

That followed on the heels of San Francisco cornerback Chris Culliver’s arrest in March on suspicion of felony hit and run and reckless driving after he drove a car into a bicyclist and fled.

Because the players are essentially on their own for the next month until training camp begins, meaning plenty of free time with little to no supervision, Harbaugh gave them a stern reminder to avoid trouble.

“Be aware of who you associate with, friend or foe,” Harbaugh said, summing up his message to the players. “There always seems to be a foe presence. Mainly, surround yourself with good people.”

Kaepernick has had to do that for reasons other than what happened in Miami. This month, the 2011 second-round draft pick signed a $126 million, six-year contract extension.

Already a target of defensive players on the field, Kaepernick and his new wealth became a target off the field the instant he signed the deal. Thus his emphasis on being more cautious.

“You want to keep good people around all the time, regardless of where you’re at,” Kaepernick said.

The 49ers wrapped up their mandatory minicamp with a brief workout in the afternoon.

Kaepernick played catch and joked with some of his teammates before turning serious during a 7-on-7 drill when he completed a handful of short passes over the middle and rifled a deep throw in traffic to wide receiver Anquan Boldin.

After practice ended, Kaepernick and several teammates engaged in a heated mini-basketball game inside the locker room. At one point, the quarterback glanced at the nearly two dozen reporters standing near his locker waiting for him then turned his attention back to the basketball game.

As the crowd near his locker continued to grow, Kaepernick retreated to the players’ lounge for about 30 minutes to catch the latest on the World Cup before finally emerging to talk.

“For the most part I’m going to be me,” Kaepernick said. “Off the field you just have to look out for what other people’s intentions are. I’m going to be more regardless.”

Boldin, fellow wide receiver Quinton Patton and Kaepernick worked out together in Florida during the offseason. Kaepernick and Boldin agree the time there was critical and beneficial to both.

“When we were down in Florida we got an opportunity to work together,” said Boldin, who caught 85 passes for 1,179 yards and seven touchdowns during his first season with the 49ers. “So our communication is a lot better. We’re on the same page, we’re seeing things and we’re talking.”

NOTES: Harbaugh is still unsure whether Smith will be at training camp or not. He is scheduled to be sentenced on three felony weapons charges and two misdemeanor counts of driving under the influence on July 25 — two days after the 49ers report to training camp and one day after their first practice. The pass-rush specialist is also facing a possible NFL suspension. “That’s to be determined,” Harbaugh said when asked about Smith’s situation. “As you can see he’s out here practicing, part of the team.” … Two-time Pro Bowl tight end Vernon Davis and right guard Alex Boone remained the most notable absences. Both players are seeking new contracts and did not take part in the mandatory minicamp.