(Reuters) - Speciality finance company Ares Capital Corp (>> Ares Capital Corporation) agreed to buy smaller rival American Capital Ltd (>> American Capital Ltd.) in a cash-and-stock deal valued at $3.4 billion (£2.35 billion), aiming to capture a bigger share of lending to mid-sized firms as big banks turn cautious.

The deal, which does not include American Capital's mortgage management unit, comes about five months after the Bethesda, Maryland-based company said it would solicit offers.

American Capital has been under fire from activist investor Elliott Management Corp for its performance and its plan to spin off some assets into a new business development company (BDC).

BDCs are closed-end investment funds that lend mainly to privately owned mid-sized businesses. Ares is the biggest BDC in the United States by assets while American Capital, in addition to operating as a BDC, has a large asset management business.

BDCs have been hit by highly competitive underwriting conditions and muted deal flows, affecting their share prices, portfolio yields and access to growth capital.

Elliott Management, which owns 14.4 percent of American Capital, said it strongly supported the Ares deal. Elliott had said the BDC plan would have put valuable assets at risk and entrenched management.

If the deal falls apart, Elliott would be able to appoint one of four American Capital directors, with the other three to be mutually agreed upon by Elliott and American Capital.

American Capital and Ares Capital had combined investments of more than $13 billion at fair value as of March 31.

Ares Capital is offering $6.41 per share and 0.483 of its shares for each share of American Capital.

Ares Capital shares closed down 2.4 percent at $14.83, while American Capital shares were up about 0.6 percent at $15.72.

"We view the deal as very positive for both," Sun Trust Robinson analysts wrote in client note. "Ares finds another avenue to grow its leading middle market lending franchise ... while Ares gains another $4 billion of (assets under management)."

American Capital Mortgage Management will be sold to American Capital Agency Corp (>> American Capital Agency Corp.) for $562 million.

Reuters, citing sources, reported in April that Ares Capital parent Ares Management LP (>> Ares Management LP) was among the potential suitors for American Capital.

Ares shareholders will own about 74 percent of the combined company after the close of the deal.

Wells Fargo Securities and Bank of America Merrill Lynch advised Ares Capital. Goldman Sachs and Credit Suisse Securities LLC advised American Capital.

(Reporting by Sruthi Shankar in Bengaluru; Editing by Kirti Pandey and Ted Kerr)

By Sruthi Shankar