Cisco Systems agreed Tuesday to buy Sourcefire, a provider of cybersecurity services, for about $2.7 billion in cash, in a reflection of the growing fervor for companies that can help guard against computer-based attacks.

Under the terms of the deal, Cisco will pay $76 a share in cash, nearly 30 percent higher than Sourcefire's closing price on Monday. The offer includes retention-based incentives for Sourcefire's executives.

The deal is Cisco's biggest since its $5 billion acquisition of NDS Group Ltd. last year.

Sourcefire, founded in 2001, has grown into a major cybersecurity provider — one that has rejected many takeover bids through the years. Last year, the company reported $5 million in profit on revenue $223.1 million.

In a statement, Cisco said that adding Sourcefire will give it a portfolio of next-generation security offerings. "Buy has always been a key part of our build-buy-partner innovation strategy," said Hilton Romanski, a Cisco vice president for corporate development.

"Sourcefire aligns well with Cisco's future vision for security and supports the key pillars of our security strategy."

The deal is expected to close in the second half of the year, pending approval by regulators and other closing conditions.

It is expected to slightly dilute Cisco's earnings for its 2014 fiscal year.

Shares in Sourcefire climbed about 29 percent in premarket trading, to $76.40, over the deal price, in a potential sign that investors might be expecting a bidding war. Shares in Cisco dipped slightly, to $25.66.

Cisco was advised by Centerview Partners, while Sourcefire was advised by Qatalyst Partners, the boutique investment bank founded by Frank Quattrone.