WASHINGTON (AP) — For nearly six years, a senior Secret Service agent kept his extramarital affair with a Mexican woman a secret from the agency responsible for protecting the president.

But in the wake of an embarrassing prostitution scandal involving 13 agents and officers, Rafael Prieto's secret was revealed by a fellow employee amid concerns the Secret Service wasn't enforcing its rules consistently. With an internal investigation ongoing, Prieto apparently committed suicide last week, people familiar with the matter told The Associated Press.

Prieto, a married father assigned to the security detail for President Barack Obama, admitted the years-long relationship with a woman from Mexico to U.S. investigators when confronted. Before his death, he was the subject of an investigation focused on whether he violated agency rules that require disclosing relationships with foreigners, those familiar with the matter said. They spoke on condition of anonymity because they were not authorized to discuss Prieto's death or the investigation.

Secret Service rules require that employees with a security clearance notify the agency about any relationship with a foreign citizen to ensure that the person is not a risk to national security. There is no evidence that Prieto's relationship posed any security threat. Failing to disclose such a relationship would be not be a crime, but a violation of the agency's administrative rules.

Prieto was serving on the protective detail for Obama, though he was not on duty at the time of his death. As recently as 2009, he was identified as the resident agent in charge at the Secret Service's office in White Plains, N.Y. He had worked for the Secret Service for 22 years. He was 47, according to public records.

Prieto's apparent cause of death was carbon monoxide poisoning. He was found in his car with the engine running. His death was being investigated by Metropolitan Police in Washington and the medical examiner's office.

"Rafael Prieto had a distinguished 20-year career with the Secret Service that was marked by accomplishment, dedication and friendships," agency spokesman Edwin Donovan said in a statement. "The Secret Service is mourning the loss of a valued colleague."

The Secret Service protects the lives of the president, vice president and their families, and also investigates counterfeiting, bank fraud, computer hacking and other financial crimes.

The behavior of Secret Service agents and officers has come under scrutiny since 13 employees were implicated in a prostitution scandal in Cartagena, Colombia, in April.

Those employees were in the Caribbean resort city in advance of Obama's arrival for a South American summit. After a night of heavy partying in some of Cartagena's bars and clubs, the employees brought women, including prostitutes, back to the where they were staying. The incident became public after one agent refused to pay a prostitute and argued with her in a hotel hallway. Prieto was never in Colombia during the scandal.

Eight of those Secret Service employees have been forced out of the agency, three were cleared of serious misconduct and at least two are fighting to get their jobs back.

The scandal prompted Secret Service Director Mark Sullivan to issue a new code of conduct that barred employees from drinking within 10 hours of the start of a shift or bringing foreigners to their hotel rooms.

Also on HuffPost:

Loading Slideshow...
  • Norman Schwarzkopf

    Served as: United States Army general, Desert Storm commander Died on: Dec. 27, 2012 at age 78.

  • Robert Bork

    Served as: U.S. Solicitor General (June 1973 - Jan. 1977) Died on: Dec. 19, 2012 at age 85.

  • Daniel Inouye

    Served as: U.S. Senator (D-Hawaii) from Jan. 1963 until his death Died on: Dec. 17, 2012 at age 88.

  • Jack Brooks

    Served as: U.S. Congressman (D-Texas) from 1953-1995 Died on: Dec. 4, 2012 at age 89.

  • Warren Rudman

    Served as: U.S. Senator (R-N.H.) from 1980-93 Died on: Nov. 19, 2012 at age 82.

  • George McGovern

    Served as: U.S. Senator (D-S.D.) from 1963-1981. Ran for: president in 1972 as the Democratic Party nominee. Died on: Oct. 21, 2012 at age 90.

  • Arlen Specter

    Served as: U.S. Senator from Pennsylvania (R from 1981-2009, D from 2009-11) Died on: Oct. 14, 2012 at age 82 of complications from non-Hodgkins Lymphoma.

  • Sam Gibbons

    Served as U.S. Congressman (D-Fla.) from 1963-1997 Died on: Oct. 9, 2012 at age 92 from natural causes.

  • Chris Stevens

    Served as: U.S. Ambassador to Libya (June 2012 - Sept. 2012) Died on: Sept. 11, 2012 in an attack on a U.S. consulate in Libya. Information Officer Sean Smith, and Navy SEALs/security officials Glen Doherty and Tyrone Woods were also killed.

  • Edwin Wilson

    Served as: CIA officer Died on: Sept. 10, 2012 at age 84 of complications from heart valve replacement surgery.

  • Paul McCracken (2nd from right)

    Served as: Chairman of the President's Council of Economic Advisers (R) from 1969-71 Died on: August 3, 2012 at age 96.

  • Jim Abdnor

    Served as: U.S. Congressman (R-S.D.) from 1973-81 and from 1981-87. Died on: May 16, 2012 at age 89 of natural causes.

  • Mary Richardson Kennedy (Left)

    Wife of Robert F. Kennedy Jr. from 1994 to her death in 2012 Died on: May 16, 2012 at age 52 from an apparent suicide.

  • Nicholas Katzenbach

    Served as: U.S. Attorney General (D) from 1965-66 Died on: May 8, 2012 at age 90 from natural causes.

  • Donald Payne

    Served as: U.S. Congressman (D-N.J.) from 1989-2012. Died on: March 6, 2012 at age 77 from colon cancer.

  • Kevin H. White (Center)

    Served as: Mayor of Boston (1968-84) Died on: Jan. 27, 2012 at age 82.

  • Hulett Smith

    Served as: West Virginia Governor (1965-69) Died on: Jan. 15, 2012 at age 93.

  • Edward Derwinski (Left)

    Served as: U.S. Congressman (R-Ill.) from 1959-83, Secretary of Veterans' Affairs (1989-92) Died on: Jan. 15, 2012 at age 85.

  • Bill Janklow

    Served as: Governor (R-S.D.) from 1979-87 / 1995-2003 and Congressman from 2003-04 Died on: Jan. 12, 2012 at age 72 from brain cancer.

  • Tony Blankley

    Served as: Press Secretary for Speaker of the House Newt Gingrich (R) Died on: Jan. 7, 2012 at age 63 from stomach cancer.

  • Ed Jenkins

    Served as: U.S. Congressman (D-Ga.) from 1977-1993 Died on: Jan. 1, 2012 at age 78.