Barclays Plc is appealing a judge's ruling that handed the trustee for Lehman Brothers Holdings Inc's brokerage arm about $4 billion related to the rushed purchase of the failed investment bank's North American business.

In court papers filed Friday, Barclays said it will appeal to Manhattan federal court the ruling reached by Judge James Peck in U.S. Bankruptcy Court in Manhattan in February.

The ruling entitled the Lehman estate to about $4 billion in so-called margin assets, including the return of roughly $2 billion that trustee James Giddens had already delivered to Barclays.

A Barclays spokesman said in June the company would likely appeal.

Barclays attorney Jonathan Schiller said Peck erred in his decision.

Barclays was expressly promised certain assets, and relied upon receiving them when making the decision to move forward with this historic acquisition, Schiller said in a statement Friday.

Barclays has argued in the past it should be entitled to the margin assets -- collateral Lehman had posted to cover outstanding derivatives trades -- because it took on significant risk when acquiring Lehman's exchange-traded derivatives at the height of the financial crisis. Barclays has said it never would have taken on that risk if not for the margin held to secure those derivatives.

Barclays is also appealing Peck's ruling that it is not unconditionally entitled to about $769 million in Lehman's customer accounts.

Giddens said the matter should be closed.

More than four months after the Court's opinion on these issues, we believe that clarity and finality have been reached, Giddens said in a statement on Friday.

Barclays won aspects of the case, including Peck's overall ruling validating its hurried purchase of Lehman's brokerage in the days following its filing of the largest bankruptcy in U.S. history.

Barclays also prevailed in a scuffle with the trustee over which side was entitled to $1.1 billion in clearance box assets, money held to facilitate the clearance of securities trading. A spokesman for the trustee declined to comment on whether Giddens will appeal that element of the case.

Lehman filed for bankruptcy protection on September 15, 2008, listing $639 billion in assets, six times more than any other bankrupt U.S. company.

The case is In re Lehman Brothers Holdings Inc, U.S. Bankruptcy Court, Southern District of New York, No. 08-13555.

(Reporting by Nick Brown; editing by Gary Hill and Andre Grenon)