It was all over in 10 minutes, but it cost Barclays nearly $44 million and landed another blow to the giant bank's reputation.

Nearly two years ago, a Barclays trader took advantage of weak internal controls in a bid to rig the price of gold and profit at a customer's expense.

On Friday, Barclays (BCS) was fined £26 million, or nearly $44 million, by British regulators. Public documents lay out how the trader was able to slip through the bank's oversight.

Related: Barclays to shed 19,000 jobs

The story begins on June 27, 2012. It was already a lousy day in the history of Barclays. The U.K. banking icon had been exposed for trying to manipulate global interest rates and fined $453 million.

Separately, gold trader Daniel Plunkett stood to lose heavily on a single trade.

A client of his had staked about $43 million on a two-year bet that the price of gold would rise.

Plunkett was on the other side of that bet: If gold prices rose, he would lose money.

The contract for the trade was based on the London Gold Fixing -- a benchmark price set by a group of banks, including Barclays, in a process that dates back to 1919.

If gold was "fixed" above $1,558.96 an ounce on June 28, the bank would have to pay $3.9 million and Plunkett's trading book would take a hit.

On June 27, gold was fixed at $1,573.50. And worse, future prices were trading higher that evening.

So Plunkett emailed the metals trading desk at Barclays to tell them he was hoping for a "mini puke" -- or fall -- in the price the following day.

"Hopefully we fix 1,558, or 1,558.75 ideal," he repeated to a colleague early on June 28, regulators said.

At the time, Barclays' systems were unable to spot such attempts to manipulate benchmark prices. It couldn't properly manage the conflict of interest between being part of the price-setting club and selling products dependent on those prices.

It was a weakness Plunkett was able to exploit.

The Gold Fixing began as usual at 3 pm. Deutsche Bank (DB), HSBC (HBCYF), Scotiabank and Societe Generale (SCGLF) joined Barclays on a conference call.

After a few minutes weighing up buying and selling interest, the group came up with a proposed "fix" of $1,558.50.

But the balance swung in favor of buyers, so Plunkett jumped in with a sell order for 60,000 ounces (worth about $90 million) in the hope of preventing a price rise.

At 3:10 pm the "fix" was done at $1,558.50, letting Barclays off the hook and boosting Plunkett's trading book by $1.75 million.

Related: Goldman Sachs under scrutiny for high speed trading

Plunkett's victory was short-lived. The customer demanded an explanation almost immediately, and after an investigation, Barclays made good on the trade.

"We very much regret the situation that led to this settlement," said Barclays CEO Antony Jenkins. The bank has worked hard to improve systems and controls, and was committed to the "highest standards," he added.

Plunkett was fined £96,500 and banned from trading.