The people who run Philadelphia's $4 billion pension investment fund are celebrating fat profits for fiscal year 2017: Their bets on U.S. stocks — and some foreign assets — paid off as the equity market hit record highs earlier this year, and the falling U.S. dollar boosted the value of its overseas assets.

The system needs every dollar it can get: While pension costs have ballooned to one-sixth of the city budget in recent years — more than it spends on working police — assets remain far below future pension liabilities. So the city needs above average performance to keep paying retirees, who outnumber working police, fire and civilian employees, without boosting taxes to pay them.

Philadelphia investments returned 12.9 percent in the 12 months ended June 30, far above the city's 7.7 percent long-term annual target.

"We had a pretty good year, and it wasn't an accident," finance director Rob DuBow told me. "We improved our performance, while reducing our costs, while moving into passive investments," such as index funds from Rhumb Line LLC, a Boston firm that charges the city as little as 2 basis points. That's 2 percent of 1 percent of the money invested, less than one-fiftieth of the fees formerly paid to some of the hedge fund managers the city fired last year for lagging returns.

"We were slightly overweight U.S. equities," said chief investment officer Chris DiFusco. With the S&P surging nearly 18 percent for the fiscal year (total return), the city did well: Its index funds were tied to broader stock indices such as the Russell 1000 index, which beat the S&P 500.

Also, several of the city's active stock-pickers beat the indices — Lancaster-based Emerald Asset Management topped 27 percent — because they owned extra biotech stocks, which beat the market.

While other Philadelphia-area pension plans haven't reported fiscal-year results yet, DuBow says the city looks as if it will report in the top 25 percent, or better, of large public plans for the year. Among funds that have reported, "we're ahead of CalPERS, North Carolina, Virginia, Massachusetts," and they also expect to show bigger profits than the plan in neighboring Montgomery County, which fired all its private-sector managers to invest in Vanguard and SEI indexed funds four years ago — a model Gov. Wolf had urged other pension systems to copy.

Of course, one-year returns are fleeting, and the city's advantage is fragile: Like other pension plans, the system actually lost money in calendar year 2016, when markets were depressed in advance of U.S. elections. Some stock traders worry the bull market that took off with the election of Donald Trump is overvalued; a drop would hit city returns extra hard.

Foreign stock funds owned by Philadelphia also topped 20 percent, aided by the drop in the U.S. dollar, which means profits on foreign investments are worth more when translated into U.S. currency.

Weak bond returns continued to drag down total returns. Brandywine Global Investment Management, a Legg Mason affiliate based in University City, beat other city bond managers with returns topping 9 percent. DiFusco attributed the jump to a focus on foreign markets alongside solid U.S. credits.

Among the hedge funds still owned by the city, Elizabeth Park Capital Managmeent, an African American-owned firm based in Cleveland, reported net gains above 30 percent, thanks to a concentration of investments in local and regional banks, which have been rising in response to a series of recent bank acquisitions.

Real estate investment yields trailed. Pension director Francis Bielli says he's hopeful about the city's recent investments in infrastructure funds, which he says the city has purchased as "an alternative to master limited partnerships," mostly in oil investments," which were profitable in the early 2010s but have lost value as oil prices declined.