Republican presidential candidate Donald Trump is competing against Democrat Kamala Harris in this year's US election
Republican presidential candidate Donald Trump is competing against Democrat Kamala Harris in this year's US election AFP

Secret Service agents opened fire after seeing a person with a gun near Donald Trump's West Palm Beach golf course while he was there golfing on Sunday afternoon, the FBI said.

Trump's campaign reported that the Republican presidential candidate was safe.

"President Trump is safe following gunshots in his vicinity. No further details at this time," said a statement from his campaign spokesman Steven Cheung.

Trump had been golfing at his course, not far from his Mar-a-Lago residence, during a day away from the presidential campaign, multiple media reports said.

The shooting took place on the grounds of the golf course, and a "person of interest" has been detained along with a weapon.

He was later identified as Ryan Wesley Routh, the Associated Press reported.

Trump had been accompanied at the time by his Secret Service protective detail -- as is standard practice -- when shots were fired.

A weapon, reportedly an AK-47 style rifle, was recovered. Palm Beach County Sheriff Ric Bradshaw said the gunman's rifle had a scope and he had two backpacks hanging on a fence along with a GoPro camera.

Routh had fled the scene but was pulled over later and arrested.

The incident came amid heightened concern for the safety of both candidates -- just two months after the former president was wounded in the ear when a gunman opened fire during a Trump rally in Pennsylvania.

The White House quickly issued a statement saying both President Joe Biden and Vice President Kamala Harris, Trump's Democratic rival in the November elections, had been briefed about the incident.

"They are relieved to know that he is safe," the statement said.

The US Secret Service, tasked with protecting presidents, former presidents and other dignitaries, faced criticism after the Pennsylvania incident.

Kimberly Cheatle, the head of the agency, resigned amid the ensuing scrutiny, and at least five Secret Service agents were placed on administrative leave.

Cheatle acknowledged in her letter of resignation that the agency "fell short" of its mission to protect the nation's leaders.

The AFP contributed to this report.