Florida: Shots were fired near Donald Trump, his team reported on Sunday, in the US state of Florida.
The FBI said it was investigating "what appears to be an attempted assassination of former President Trump."
Rifle and camera recovered from scene
US Secret Service agents identified and fired on a suspect aiming a weapon on part of the Trump International Golf Course in West Palm Beach early in the afternoon, authorities said in a press conference later on Sunday.
"We are not sure right now if the individual was able to take a shot at our agents," said Rafael Barros of the Secret Service.
The suspect fled in a black SUV and was later detained in nearby Martin County by local law enforcement.
"We have somebody in custody right now that is a potential suspect," Palm Beach County Sheriff Ric Bradshaw said. He praised a witness who had seen the suspect flee to a car and had taken a photo of its license plate, helping police to track him down.
Bradshaw said the suspect was hiding in the bushes, situated about 400 to 500 yards (356 to 457 metres) away from Trump, while the former president played golf on a nearby hole.
Secret Service agents, who protect US presidents and presidential candidates and other dignitaries in the States, had been scouting ahead of Trump on a security sweep when they engaged the suspect.
Police in Palm Beach found an "AK-47-style assault rifle" with a telescopic sight and a GoPro camera in the bushes at the scene, Bradshaw said.
First reports only of gunshots 'in vicinity'
Earlier, Trump's campaign had reported the sound of gunfire near Trump, but had only said he was safe after the incident.
"President Trump is safe following gunshots in his vicinity. No further details at this time," said an initial statement from Trump campaign spokesman Steven Cheung.
The shots were reportedly fired close to the Trump International Golf Course in West Palm Beach. The US Secret Service said the incident took place shortly before 2 p.m. local time (1800 GMT).
Increased security after July assassination attempt
The incident comes after the former US president was shot during an assassination attempt in July, while he was speaking at a rally in Pennsylvania. A bullet grazed Trump's ear.
As a result, his campaign stepped up security. At outdoor rallies, Trump now speaks from behind an enclosure of bulletproof glass.
President Joe Biden and Vice President Kamala Harris, the Democratic presidential nominee, were "relieved" to know Trump is safe, the White House said.
Harris said on social media that she was "glad" Trump was safe, while she and Biden both said political violence had no place in the US.
"As I have said many times, there is no place for political violence or for any violence ever in our country, and I have directed my team to continue to ensure that Secret Service has every resource, capability and protective measure necessary to ensure the former president's continued safety." Biden said in a statement late on Sunday.
Reports of Ukraine links
Several world leaders condemned the alleged assassination attempt, including Ukrainian President Volodymyr Zelenskyy.
"It's good that the suspect in the assassination attempt was apprehended quickly. This is our principle: the rule of law is paramount and political violence has no place anywhere in the world," Zelenskyy said, offering his best wishes to Trump and his family.
Some US media outlets reported that the suspect had traveled to Ukraine to support the war effort against Russia.
The Kremlin also commented on the assassination attempt.
Kremlin spokesman Dmitry Peskov said that Moscow was following the tense situation in the US, adding that the incident showed that "playing with fire" had consequences.
"We can see how tense the situation is there, including between political rivals -- the political fight is intensifying," Peskov said. "We are watching it closely, but we have never interfered in this in any way and we are not interfering now."